lpe-1.2.7/0000755000175000017500000000000012352073726011230 5ustar adammadammlpe-1.2.7/Makefile.in0000644000175000017500000005462010255442112013271 0ustar adammadamm# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/configure $(top_srcdir)/intl/Makefile.in \ ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL NEWS TODO \ acconfig.h config.guess config.sub depcomp install-sh ltconfig \ ltmain.sh missing mkinstalldirs subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno configure.status.lineno mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = intl/Makefile SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(docdir)" docDATA_INSTALL = $(INSTALL_DATA) DATA = $(doc_DATA) ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DL_LIB = @DL_LIB@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GENCAT = @GENCAT@ GLIBC2 = @GLIBC2@ GLIBC21 = @GLIBC21@ GMSGFMT = @GMSGFMT@ HAVE_ASPRINTF = @HAVE_ASPRINTF@ HAVE_POSIX_PRINTF = @HAVE_POSIX_PRINTF@ HAVE_SNPRINTF = @HAVE_SNPRINTF@ HAVE_WPRINTF = @HAVE_WPRINTF@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLBISON = @INTLBISON@ INTLLIBS = @INTLLIBS@ INTLOBJS = @INTLOBJS@ INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MKINSTALLDIRS = @MKINSTALLDIRS@ MODES = @MODES@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ POSUB = @POSUB@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SLANG_LIB = @SLANG_LIB@ STRIP = @STRIP@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_INCLUDED_LIBINTL_FALSE = @USE_INCLUDED_LIBINTL_FALSE@ USE_INCLUDED_LIBINTL_TRUE = @USE_INCLUDED_LIBINTL_TRUE@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ lpe_DEPS = @lpe_DEPS@ lpe_LDFLAGS = @lpe_LDFLAGS@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ SUBDIRS = data intl man po src MAINTAINERCLEANFILES = ABOUT-NLS INSTALL Makefile.in aclocal.m4 config.guess \ config.h.in config.sub configure install-sh ltconfig \ ltmain.sh missing mkinstalldirs stamp-h.in docdir = $(datadir)/doc/lpe doc_DATA = AUTHORS BUGS COPYING CUSTOMIZE IDEAS MODES NEWS README TODO EXTRA_DIST = $(doc_DATA) autogen.sh all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ cd $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(top_srcdir)/acconfig.h cd $(top_srcdir) && $(AUTOHEADER) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 intl/Makefile: $(top_builddir)/config.status $(top_srcdir)/intl/Makefile.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: install-docDATA: $(doc_DATA) @$(NORMAL_INSTALL) test -z "$(docdir)" || $(mkdir_p) "$(DESTDIR)$(docdir)" @list='$(doc_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(docDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(docdir)/$$f'"; \ $(docDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(docdir)/$$f"; \ done uninstall-docDATA: @$(NORMAL_UNINSTALL) @list='$(doc_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(docdir)/$$f'"; \ rm -f "$(DESTDIR)$(docdir)/$$f"; \ 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. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ 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) \ || eval $$failcom; \ 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: @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ 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) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) $(mkdir_p) $(distdir)/intl $(distdir)/po @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(mkdir_p) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ distdir) \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_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 case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ --with-included-gettext \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(DATA) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(docdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr \ distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-docDATA install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-docDATA uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ check-am clean clean-generic clean-libtool clean-recursive \ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ dist-hook dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-generic distclean-hdr distclean-libtool \ distclean-recursive distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-docDATA install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic maintainer-clean-recursive \ mostlyclean mostlyclean-generic mostlyclean-libtool \ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-docDATA uninstall-info-am dist-hook: chmod -R go-w $(distdir) bin-dist: all rm -rf $(PACKAGE)-$(VERSION).bin $(MAKE) prefix=`pwd`/$(PACKAGE)-$(VERSION).bin/$(prefix) install @if test "x$(GZIP_ENV)" = "x"; then \ if test "x$(GZIP)" = "x"; then \ GZIP="--best"; \ else \ GZIP_ENV=$(GZIP); \ fi \ fi GZIP=$(GZIP_ENV) $(TAR) chozf $(PACKAGE)-$(VERSION).bin.tar.gz $(PACKAGE)-$(VERSION).bin rm -rf $(PACKAGE)-$(VERSION).bin cvs-dist: dist rm -rf $(PACKAGE)-$(VERSION)CVS rm -rf $(PACKAGE)-$(VERSION) tar xhozf $(PACKAGE)-$(VERSION).tar.gz (cd $(PACKAGE)-$(VERSION); ./configure --enable-maintainer-mode ; make maintainer-clean; cd ..) mv $(PACKAGE)-$(VERSION) $(PACKAGE)-$(VERSION)CVS @if test "x$(GZIP_ENV)" = "x"; then \ if test "x$(GZIP)" = "x"; then \ GZIP_ENV="--best"; \ else \ GZIP_ENV="$(GZIP)"; \ fi \ fi GZIP=$(GZIP_ENV) $(TAR) chozf $(PACKAGE)-$(VERSION)CVS.tar.gz $(PACKAGE)-$(VERSION)CVS rm -rf $(PACKAGE)-$(VERSION)CVS # 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: lpe-1.2.7/INSTALL0000644000175000017500000001722707075336404012273 0ustar adammadammBasic 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. lpe-1.2.7/src/0000755000175000017500000000000010556651340012015 5ustar adammadammlpe-1.2.7/src/minibuf.c0000644000175000017500000003312207743362671013625 0ustar adammadamm/* minibuf.c * * Copyright (c) 1999 Chris Smith * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #include "options.h" #include #include #include #include #include #include #include #include #include LIMITS_H #include "lpe.h" #include "input.h" #include "minibuf.h" #include "screen.h" #include "mode-utils.h" /* The global minibuffer. It is used both to ask the user for information in * commands that require it and to notify the user about various events. There * is really a need for only one of these because there's only one status bar, * so it's stored in a global variable here. */ minibuf the_mbuf; /* Set up the minibuf to ask the user for information using the specified * prompt. */ static void setup_mbuf_ask (buffer * buf, char *prompt, int compl) { the_mbuf.vis = 1; the_mbuf.focus = 1; the_mbuf.pos = 0; the_mbuf.scroll = 0; the_mbuf.compl = compl; strcpy (the_mbuf.label, prompt); the_mbuf.text[0] = '\0'; the_mbuf.width = SLtt_Screen_Cols - get_minibuf_col () - strlen (the_mbuf.label) - 3; /* given a sufficiently large filename, we may have no room at all */ if(the_mbuf.width < 0) the_mbuf.width = 0; } /* Set up the minibuf to print a notification message for the user. */ static void setup_mbuf_tell (buffer * buf, char *msg) { the_mbuf.vis = 1; the_mbuf.focus = 0; the_mbuf.scroll = 0; strcpy (the_mbuf.text, msg); the_mbuf.label[0] = '\0'; the_mbuf.width = strlen (the_mbuf.text); } /* Make the minibuf invisible after asking a question with it */ static void cleanup_mbuf (void) { the_mbuf.compl = MBUF_NO_COMPL; the_mbuf.vis = 0; the_mbuf.focus = 0; } /* Check to see if the minibuf needs to be scrolled sideways. This is called * after cursor movement to see that the buffer scrolls as it would be expected * to do. */ static int mbuf_check_scrolling (void) { int ret = 0; if (the_mbuf.pos < the_mbuf.scroll) { the_mbuf.scroll = the_mbuf.pos; ret = 1; } if (the_mbuf.pos >= the_mbuf.scroll + the_mbuf.width) { the_mbuf.scroll = the_mbuf.pos - the_mbuf.width + 1; ret = 1; } return ret; } /* qsort compare function for alphabetical sorting */ static int mbuf_alpha_sort (const void *a, const void *b) { int i = 0; const char *pa = ((const char **) (a))[0]; const char *pb = ((const char **) b)[0]; while (*(pa + i) && *(pb + i)) if (*(pa + i) != *(pb + i)) return *(pa + i) < *(pb + i) ? -1 : 1; else ++i; return 0; } /* Find available modes. The only guarantee that libtool gives on library * names is that they'll be accompanied by a libfoo.la file, so I search for * that -- and the module name then becomes foo. For now, I assume there's a * symlink from foo.so to the appropriate actual library name on the host * system; these symlinks are created at install time to make it easier to * find an appropriate module for a mode. * * FIXME: the above description is outdated * - Gergely Nagy */ static int mbuf_modes_avail (char ***modes) { DIR *dir; struct dirent *de; char **am; char pn[PATH_MAX]; char *path, *nc, *mn; int nl; int mc = 1; am = NULL; path = getenv ("LPE_MODULE_PATH"); if (path == NULL) path = cfg_get_global_string_with_default ("module_path", DEF_MODULE_PATH); if ((am = (char **) malloc ((mc + 1) * sizeof (char *))) == NULL) ; /* XXX */ am[0] = "genmode"; do { if (*path == '~') { char *home = getenv ("HOME"); strcpy (pn, (home != NULL ? home : "/")); path++; } else { *pn = '\0'; } nc = strchr (path, ':'); if (nc != NULL) { strncat (pn, path, nc - path); path += nc - path + 1; } else { strcat (pn, path); } if ((dir = opendir (pn)) != NULL) { while ((de = readdir (dir)) != 0) { if ( (am = (char **) realloc (am, (mc + 1) * sizeof (char *))) == NULL) ; /* XXX */ if ((mn = strstr (de->d_name, ".la")) != NULL) if ((nl = strlen (de->d_name)) == mn - de->d_name + 3) /* if (strncmp(de->d_name, "lib", 3) == 0) { *mn * ='\0'; if ((am[mc] = (char *)malloc(nl + 1)) == * NULL) ; strcpy(am[mc], de->d_name + 3); ++mc; } */ { *mn = '\0'; if ( (am[mc] = (char *) malloc (strlen (de->d_name) + 1)) == NULL) ; /* XXX */ strcpy (am[mc], de->d_name); ++mc; } } closedir (dir); } } while (nc != 0); *modes = am; return mc; } /* Try to complete a mode: */ static void mbuf_mode_compl (void) { char **am; int ml; int found = -1; int i = 0; int amn = 0; if ((amn = mbuf_modes_avail (&am)) == 0) { SLtt_beep (); return; } qsort (am, amn, sizeof (char *), mbuf_alpha_sort); if (strlen (the_mbuf.text) > 0) { if ((the_mbuf.compl & MBUF_PEND_COMPL) != MBUF_PEND_COMPL) { do { if (strstr (am[i], the_mbuf.text) == am[i]) { found = i; break; } } while (++i < amn); } else { do { if (strcmp (the_mbuf.text, am[i]) == 0) { found = (i + 1 >= amn) ? 0 : (i + 1); break; } } while (++i < amn); } } else { found = 0; } if (found > -1) { if ((ml = strlen (am[found])) > 99) ml = 99; strncpy (the_mbuf.text, am[found], ml); the_mbuf.text[ml] = '\0'; the_mbuf.pos = ml; the_mbuf.compl |= MBUF_PEND_COMPL; } else { SLtt_beep (); } while (amn-- > 1) { if (strcmp (am[amn], "genmode")) free (am[amn]); } free (am); } /* Find available files. */ static int mbuf_files_avail (char ***files) { DIR *dir; struct dirent *de; char **am; int mc = 0; am = NULL; if ((am = (char **) malloc ((mc + 1) * sizeof (char *))) == NULL) ; /* XXX */ if ((dir = opendir (".")) != NULL) { while ((de = readdir (dir)) != 0) { if ((am = (char **) realloc (am, (mc + 1) * sizeof (char *))) == NULL) ; /* XXX */ if (de->d_name[0] != '.') { if ((am[mc] = (char *) malloc (strlen (de->d_name) + 1)) == NULL) ; /* XXX */ strcpy (am[mc], de->d_name); ++mc; } } closedir (dir); } *files = am; return mc; } /* Try to complete a file: */ static void mbuf_file_compl (void) { char **am; int ml; int found = -1; int i = 0; int amn = 0; if ((amn = mbuf_files_avail (&am)) == 0) { SLtt_beep (); return; } qsort (am, amn, sizeof (char *), mbuf_alpha_sort); if (strlen (the_mbuf.text) > 0) { if ((the_mbuf.compl & MBUF_PEND_COMPL) != MBUF_PEND_COMPL) { do { if (strstr (am[i], the_mbuf.text) == am[i]) { found = i; break; } } while (++i < amn); } else { do { if (strcmp (the_mbuf.text, am[i]) == 0) { found = (i + 1 >= amn) ? 0 : (i + 1); break; } } while (++i < amn); } } else { found = 0; } if (found > -1) { if ((ml = strlen (am[found])) > 99) ml = 99; strncpy (the_mbuf.text, am[found], ml); the_mbuf.text[ml] = '\0'; the_mbuf.pos = ml; the_mbuf.compl |= MBUF_PEND_COMPL; } else { SLtt_beep (); } while (amn-- > 1) { free (am[amn]); } free (am); } /* Handle the tab key according to the compl flag in minibuf */ static void mbuf_key_tab (buffer * buf) { if ((the_mbuf.compl & MBUF_FILE_COMPL) == MBUF_FILE_COMPL) { mbuf_file_compl (); mbuf_check_scrolling (); refresh_banner = 1; } else if ((the_mbuf.compl & MBUF_MODE_COMPL) == MBUF_MODE_COMPL) { mbuf_mode_compl (); mbuf_check_scrolling (); refresh_banner = 1; } else { SLtt_beep (); } } /* Move one character to the left while typing in the minibuf */ static void mbuf_key_left (buffer * buf) { if (the_mbuf.pos == 0) SLtt_beep (); else { the_mbuf.pos--; if (mbuf_check_scrolling ()) refresh_banner = 1; } } /* Move one character to the right while typing in the minibuf */ static void mbuf_key_right (buffer * buf) { if (the_mbuf.text[the_mbuf.pos] == '\0') SLtt_beep (); else { the_mbuf.pos++; if (mbuf_check_scrolling ()) refresh_banner = 1; } } /* Move the cursor to the beginning of the minibuf */ static void mbuf_key_home (buffer * buf) { if (the_mbuf.pos == 0) SLtt_beep (); else { the_mbuf.pos = 0; if (mbuf_check_scrolling ()) refresh_banner = 1; } } /* Move the cursor to the end of the minibuf. */ static void mbuf_key_end (buffer * buf) { if (the_mbuf.text[the_mbuf.pos] == '\0') SLtt_beep (); else { the_mbuf.pos = strlen (the_mbuf.text); if (mbuf_check_scrolling ()) refresh_banner = 1; } } static void mbuf_key_next_word (buffer * buf) { /* skip the rest of this word and the whitespace after it. */ while ((the_mbuf.text[the_mbuf.pos] != '\0') && !isspace (the_mbuf.text[the_mbuf.pos])) { the_mbuf.pos++; } while (isspace (the_mbuf.text[the_mbuf.pos])) { the_mbuf.pos++; } if (mbuf_check_scrolling ()) refresh_banner = 1; } static void mbuf_key_prev_word (buffer * buf) { /* if we're at the beginning of this word, skip whitespace to get to the * * previous word. Then go to the beginning of the word. */ while ((the_mbuf.pos != 0) && isspace (the_mbuf.text[the_mbuf.pos - 1])) { the_mbuf.pos--; } while ((the_mbuf.pos != 0) && !isspace (the_mbuf.text[the_mbuf.pos - 1])) { the_mbuf.pos--; } if (mbuf_check_scrolling ()) refresh_banner = 1; } /* Delete the character in the minibuf just before the cursor */ static void mbuf_key_backspace (buffer * buf) { if (the_mbuf.pos == 0) SLtt_beep (); else { char *p; the_mbuf.pos--; p = the_mbuf.text + the_mbuf.pos; do { *p = *(p + 1); ++p; } while (*p != '\0'); mbuf_check_scrolling (); refresh_banner = 1; } } /* Delete the character in the minibuf just after the cursor position */ static void mbuf_key_delete (buffer * buf) { if (the_mbuf.pos == strlen (the_mbuf.text)) SLtt_beep (); else { char *p; p = the_mbuf.text + the_mbuf.pos; while (*p != '\0') { *p = *(p + 1); ++p; } refresh_banner = 1; } } /* Handle a key type in the minibuf by inserting it into the text. */ static void mbuf_key_typed (buffer * buf, int c) { if (strlen (the_mbuf.text) == 99) SLtt_beep (); else { char *p; char ch; p = the_mbuf.text + the_mbuf.pos; while (*p != '\0') { ch = *p; *p = c; c = ch; p++; } *p = c; *(p + 1) = '\0'; the_mbuf.pos++; mbuf_check_scrolling (); refresh_banner = 1; } } /* Elegantly suspend the editor while the minibuf has focus. This replaces the * default mechanism because S-Lang seems to provide no option to preserve the * stop key (traditionally Ctrl-Z). So I am reduced to simulating it in lpe by * sending SIGSTOP to the current process manually. */ static void mbuf_key_suspend (buffer * buf) { cleanup_slang (); raise (SIGTSTP); init_slang (); } /* The main input loop for the minibuf. Gets keys from the keyboard and puts * dispatches them as appropriate. */ static int mbuf_process_input (buffer * buf) { int c; if (!SLang_input_pending (0)) draw_screen (buf); c = SLkp_getkey (); if (SLKeyBoard_Quit) return 1; if (c != '\t') the_mbuf.compl &= ~MBUF_PEND_COMPL; switch (c) { case LPE_LEFT_KEY: mbuf_key_left (buf); break; case LPE_RIGHT_KEY: mbuf_key_right (buf); break; case LPE_HOME_KEY: mbuf_key_home (buf); break; case LPE_END_KEY: mbuf_key_end (buf); break; case LPE_NEXT_WORD_KEY: mbuf_key_next_word (buf); break; case LPE_PREV_WORD_KEY: mbuf_key_prev_word (buf); break; case LPE_BACKSPACE_KEY: mbuf_key_backspace (buf); break; case LPE_DELETE_KEY: mbuf_key_delete (buf); break; case '\n': case '\r': case LPE_ENTER_KEY: return 1; case LPE_REFRESH_KEY: refresh_complete = 1; break; case LPE_SUSPEND_KEY: mbuf_key_suspend (buf); break; case '\t': mbuf_key_tab (buf); break; case LPE_UP_KEY: case LPE_DOWN_KEY: case LPE_PGUP_KEY: case LPE_PGDN_KEY: case LPE_BUF_START_KEY: case LPE_BUF_END_KEY: case LPE_OPEN_KEY: case LPE_SAVE_KEY: case LPE_SAVE_ALT_KEY: case LPE_EXIT_KEY: case LPE_KILL_KEY: case LPE_YANK_KEY: case LPE_SEARCH_KEY: case LPE_FIND_NEXT_KEY: case LPE_GOTOLN_KEY: case LPE_READF_KEY: case LPE_CLEARMOD_KEY: case LPE_TAB_SWAP_KEY: case LPE_REP_KEY: case LPE_REP_QUAD_KEY: case LPE_SET_MODE_KEY: case LPE_AI_TOGGLE_KEY: case LPE_RECORDER_KEY: case LPE_PLAYBACK_KEY: case LPE_DEBUG_KEY: SLtt_beep (); break; default: /* ignore control characters */ if (c >= 27) mbuf_key_typed (buf, c); break; } return 0; } /* Ask a question using the minibuf. This function forms half of the external * interface to the minibuf. It is called when a command needs extra * information to prompt for and read that information. */ char * mbuf_ask (buffer * buf, char *prompt, int compl) { setup_mbuf_ask (buf, prompt, compl); refresh_banner = 1; while (!mbuf_process_input (buf)) ; cleanup_mbuf (); refresh_banner = 1; return SLKeyBoard_Quit ? NULL : the_mbuf.text; } /* Tell the user something using the minibuf. This is the other half of the * external interface to the minibuffer. It is called whenever a command needs * to print an error (without dying) or a notification that it succeeded. */ void mbuf_tell (buffer * buf, char *msg) { setup_mbuf_tell (buf, msg); refresh_banner = 1; } lpe-1.2.7/src/Makefile.in0000644000175000017500000005035510255442111014060 0ustar adammadamm# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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. @SET_MAKE@ SOURCES = $(lpe_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = lpe$(EXEEXT) subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am_lpe_OBJECTS = buffer.$(OBJEXT) cfg-core.$(OBJEXT) cfg.$(OBJEXT) \ exports.$(OBJEXT) genmode.$(OBJEXT) help.$(OBJEXT) \ input.$(OBJEXT) lpe.$(OBJEXT) lpecomm.$(OBJEXT) \ minibuf.$(OBJEXT) mode-utils.$(OBJEXT) screen.$(OBJEXT) \ strfuncs.$(OBJEXT) common.$(OBJEXT) lpe_OBJECTS = $(am_lpe_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(lpe_SOURCES) DIST_SOURCES = $(lpe_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DL_LIB = @DL_LIB@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GENCAT = @GENCAT@ GLIBC2 = @GLIBC2@ GLIBC21 = @GLIBC21@ GMSGFMT = @GMSGFMT@ HAVE_ASPRINTF = @HAVE_ASPRINTF@ HAVE_POSIX_PRINTF = @HAVE_POSIX_PRINTF@ HAVE_SNPRINTF = @HAVE_SNPRINTF@ HAVE_WPRINTF = @HAVE_WPRINTF@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLBISON = @INTLBISON@ INTLLIBS = @INTLLIBS@ INTLOBJS = @INTLOBJS@ INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MKINSTALLDIRS = @MKINSTALLDIRS@ MODES = @MODES@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ POSUB = @POSUB@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SLANG_LIB = @SLANG_LIB@ STRIP = @STRIP@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_INCLUDED_LIBINTL_FALSE = @USE_INCLUDED_LIBINTL_FALSE@ USE_INCLUDED_LIBINTL_TRUE = @USE_INCLUDED_LIBINTL_TRUE@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ lpe_DEPS = @lpe_DEPS@ lpe_LDFLAGS = @lpe_LDFLAGS@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ MAINTAINERCLEANFILES = Makefile.in SUBDIRS = modes lpe_SOURCES = \ buffer.c buffer.h \ cfg-core.c cfg-core.h \ cfg.c cfg.h \ exports.c exports.h \ genmode.c genmode.h \ help.c help.h \ highlight.h \ i18n.h \ input.c input.h \ lpe.c lpe.h \ lpecomm.c lpecomm.h \ minibuf.c minibuf.h \ mode-utils.c mode-utils.h \ options.h \ screen.c screen.h \ strfuncs.c strfuncs.h \ common.c common.h INCLUDES = -DDATADIR=\"$(datadir)\" lpe_LDADD = @INTLLIBS@ @INTLOBJS@ @DL_LIB@ @SLANG_LIB@ -lncurses lpe_DEPENDENCIES = @lpe_DEPS@ @INTLOBJS@ @USE_INCLUDED_LIBINTL_FALSE@AM_CPPFLAGS = -DLOCALEDIR=\"$(datadir)/locale\" @USE_INCLUDED_LIBINTL_TRUE@AM_CPPFLAGS = -DLOCALEDIR=\"$(datadir)/@DATADIRNAME@\" -I$(top_srcdir)/intl EXTRA_DIST = templ.c templ.h all: all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ || test -f $$p1 \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ rm -f "$(DESTDIR)$(bindir)/$$f"; \ done clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done lpe$(EXEEXT): $(lpe_OBJECTS) $(lpe_DEPENDENCIES) @rm -f lpe$(EXEEXT) $(LINK) $(lpe_LDFLAGS) $(lpe_OBJECTS) $(lpe_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buffer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfg-core.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exports.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genmode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/help.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpecomm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minibuf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mode-utils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/screen.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strfuncs.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: # 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. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ 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) \ || eval $$failcom; \ 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: @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ 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) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(mkdir_p) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(PROGRAMS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-exec-am: install-binPROGRAMS install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ clean clean-binPROGRAMS clean-generic clean-libtool \ clean-recursive ctags ctags-recursive distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-recursive distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-info-am # 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: lpe-1.2.7/src/input.c0000644000175000017500000015203410255442704013323 0ustar adammadamm/* input.c * * Copyright (c) 1999 Chris Smith * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #include "options.h" #include #include #include #include #include #include #include #include #include #include #include "lpe.h" #include "lpecomm.h" #include "input.h" #include "screen.h" #include "minibuf.h" #include "help.h" #include "cfg.h" #if !defined(HAVE_FLOCK) || defined(DUMMY_FLOCK) #define flock(a,b) #endif #define VALID_STATE(x,y) { \ if ((x) == NULL) \ { \ buf->state_valid_num = 0; \ buf->state_valid = buf->text; \ buf->text->start_state = 0; \ } \ else if (buf->state_valid_num > (y)) \ { \ buf->state_valid_num = (y); \ buf->state_valid = (x); \ } \ } /* A global variable to hold the current command repeater count and command * -- together, these values allow any command to be performed many times with * very few keystrokes. */ static int cmd_repeat_count = 0; static int cmd_repeat_command = 0; int public_repeat_count; /* Global variables to implement the macro recorder. */ static int macro_keys[MAX_MACRO_KEYS]; static int macro_nkeys = 0; static int macro_recording = 0; static int macro_pos = -1; static char macro_answers[MAX_MACRO_ANSWER_LEN]; static int macro_answer_pos = 0; static int macro_answer_len = 0; static int macro_reps[MAX_MACRO_KEYS]; static int macro_rep_save = -1; /* A wrapper for calls to mbuf_ask; the purpose is that when the macro recorder * is enabled, answers to mbuf questions are recorded and played back. When * the macro recorder is disabled, I can only hope the compiler is smart enough * to inline this function (which would essentially make it go away. */ static char * wrap_mbuf_ask (buffer * buf, char *prompt, int compl) { if (macro_pos != -1) { /* A macro is playing; don't ask, and return the previously recorded * * answer. Also, advance the answer position so the next mbuf * question * returns the next answer. If something is wrong and we * are out of * recorded answers, fall through to ask interactively. */ if (macro_answer_pos < macro_answer_len) { char *ans = macro_answers + macro_answer_pos; macro_answer_pos += strlen (ans) + 1; return ans; } } else if (macro_recording) { /* A macro is recording; ask the question, but record the answer in * * mbuf_answers before returning it. */ char *ans = mbuf_ask (buf, prompt, compl); if (ans == NULL) { /* Record a '\0' -- it's all the same */ macro_answers[macro_answer_len++] = '\0'; return ans; } else { if (macro_answer_len + strlen (ans) + 1 > MAX_MACRO_ANSWER_LEN) { /* This is just as much an overflow as running out of keys */ mbuf_tell (buf, _("Macro overflow")); SLtt_beep (); macro_recording = 0; macro_nkeys = 0; } strcpy (macro_answers + macro_answer_len, ans); macro_answer_len += strlen (ans) + 1; return ans; } } else return mbuf_ask (buf, prompt, compl); /* * FIXME: is it right to return NULL here ? * - Gergely Nagy */ return NULL; } /* Respond to an unknown key sequence. It's not really an option to beep or * otherwise notify the user, because S-Lang sends this for some pretty common * keys, like F11 and F12. For now, actually, I am not doing anything. If * this trend continues, I'll get rid of this function. */ static void key_error (buffer * buf) { } /* Move up a single line in the buffer */ static void key_up (buffer * buf) { is_killing = 0; if (buf->pos.line->prev == NULL) SLtt_beep (); else { buf->pos.line = buf->pos.line->prev; buf->linenum--; check_col (buf); if (check_scrolling (buf)) refresh_text = 1; refresh_banner = 1; } } /* Move down a line in the buffer */ static void key_down (buffer * buf) { is_killing = 0; if (buf->pos.line->next == NULL) SLtt_beep (); else { buf->pos.line = buf->pos.line->next; buf->linenum++; check_col (buf); if (check_scrolling (buf)) refresh_text = 1; refresh_banner = 1; } } /* Move left one character, wrapping to the previous line if the cursor is at * the beginning of the current line. */ static void key_left (buffer * buf) { is_killing = 0; if (buf->pos.col > 0) { buf->pos.col--; if (buf->pos.line->txt[buf->pos.col] == '\t') set_scr_col (buf); else if (is_control (buf->pos.line->txt[buf->pos.col])) buf->scr_col -= 2; else buf->scr_col--; } else { if (buf->pos.line == buf->text) SLtt_beep (); else { buf->pos.line = buf->pos.line->prev; buf->linenum--; buf->pos.col = strlen (buf->pos.line->txt); set_scr_col (buf); refresh_banner = 1; } } buf->preferred_col = buf->scr_col; if (check_scrolling (buf)) refresh_text = 1; } /* Move right one character, wrapping to the next line if the end of a line is * reached. */ static void key_right (buffer * buf) { is_killing = 0; if (buf->pos.col < LINELEN (buf->pos)) { if (buf->pos.line->txt[buf->pos.col] == '\t') buf->scr_col += next_mult (buf->scr_col, cfg_get_global_int_with_default ("hard_tab_width", DEF_HARD_TAB_WIDTH)); else if (is_control (buf->pos.line->txt[buf->pos.col])) buf->scr_col += 2; else buf->scr_col++; buf->pos.col++; } else { if (buf->pos.line->next == NULL) SLtt_beep (); else { buf->pos.line = buf->pos.line->next; buf->linenum++; buf->pos.col = 0; buf->scr_col = 0; refresh_banner = 1; } } buf->preferred_col = buf->scr_col; if (check_scrolling (buf)) refresh_text = 1; } /* Move up one page of text */ static void key_pgup (buffer * buf) { int i; is_killing = 0; if (buf->pos.line->prev == NULL) SLtt_beep (); else { for (i = 0; (i < SLtt_Screen_Rows - 2) && buf->pos.line->prev != NULL; i++) { buf->pos.line = buf->pos.line->prev; buf->linenum--; } check_col (buf); if (check_scrolling (buf)) refresh_text = 1; refresh_banner = 1; } } /* Move down one page of text */ static void key_pgdn (buffer * buf) { int i; is_killing = 0; if (buf->pos.line->next == NULL) SLtt_beep (); else { for (i = 0; (i < SLtt_Screen_Rows - 2) && buf->pos.line->next != NULL; i++) { buf->pos.line = buf->pos.line->next; buf->linenum++; } check_col (buf); if (check_scrolling (buf)) refresh_text = 1; refresh_banner = 1; } } /* Move to the beginning of the current line. If automatic indents are on, * then do the nifty thing where home takes you to the first actual character * on the line. Otherwise, assume that the indent means nothing and go to the * real beginning of the line. */ static void key_home (buffer * buf) { is_killing = 0; if (buf->pos.col == 0) { int i = buf->pos.col; buf->scr_col = 0; while (buf->pos.line->txt[i] != '\0') { if (buf->pos.line->txt[i] == '\t') buf->scr_col += cfg_get_global_int_with_default ("hard_tab_width", DEF_HARD_TAB_WIDTH); else if (buf->pos.line->txt[i] == ' ') buf->scr_col++; else break; i++; } buf->pos.col = i; } else { int i = 0; buf->scr_col = 0; /* Find the first non-space character of the line */ while (i < buf->pos.col) { if (buf->pos.line->txt[i] == '\t') buf->scr_col += cfg_get_global_int_with_default ("hard_tab_width", DEF_HARD_TAB_WIDTH); else if (buf->pos.line->txt[i] == ' ') buf->scr_col++; else break; i++; } if (i == buf->pos.col) buf->pos.col = buf->scr_col = 0; else buf->pos.col = i; } buf->preferred_col = buf->scr_col; if (check_scrolling (buf)) refresh_text = 1; } /* Move to the end of the current line */ static void key_end (buffer * buf) { is_killing = 0; buf->pos.col = LINELEN (buf->pos); set_scr_col (buf); buf->preferred_col = buf->scr_col; if (check_scrolling (buf)) refresh_text = 1; } static void key_next_word (buffer * buf) { /* skip the rest of this word and the whitespace after it. */ while ((buf->pos.line->txt[buf->pos.col] != '\0') && !isspace (buf->pos.line->txt[buf->pos.col])) { buf->pos.col++; } while ((buf->pos.line->txt[buf->pos.col] == '\0') || isspace (buf->pos.line->txt[buf->pos.col])) { if (buf->pos.line->txt[buf->pos.col] == '\0') { if (buf->pos.line->next == NULL) break; buf->pos.line = buf->pos.line->next; buf->linenum++; buf->pos.col = 0; refresh_banner = 1; } else buf->pos.col++; } set_scr_col (buf); buf->preferred_col = buf->scr_col; if (check_scrolling (buf)) refresh_text = 1; } static void key_prev_word (buffer * buf) { /* if we're at the beginning of this word, skip whitespace to get to the * * previous word. Then go to the beginning of the word. */ while ((buf->pos.col == 0) || isspace (buf->pos.line->txt[buf->pos.col - 1])) { if (buf->pos.col == 0) { if (buf->pos.line->prev == NULL) break; buf->pos.line = buf->pos.line->prev; buf->linenum--; buf->pos.col = strlen (buf->pos.line->txt); refresh_banner = 1; } else buf->pos.col--; } while ((buf->pos.col != 0) && !isspace (buf->pos.line->txt[buf->pos.col - 1])) { buf->pos.col--; } set_scr_col (buf); buf->preferred_col = buf->scr_col; if (check_scrolling (buf)) refresh_text = 1; } /* Delete the character preceding the cursor */ void key_backspace (buffer * buf) { is_killing = 0; if (buf->pos.col == 0) { if (buf->pos.line->prev == NULL) SLtt_beep (); else { int reqlen, prevlen; buf_line *old_line; prevlen = strlen (buf->pos.line->prev->txt); reqlen = buf->pos.line->txt_len + prevlen; if (buf->pos.line->prev->txt_len < reqlen) { char *nbuf; nbuf = (char *) realloc (buf->pos.line->prev->txt, reqlen); if (nbuf == NULL) { mbuf_tell (buf, strerror (ENOMEM)); SLtt_beep (); return; } buf->pos.line->prev->txt = nbuf; buf->pos.line->prev->txt_len = reqlen; } buf->pos.col = prevlen; strcat (buf->pos.line->prev->txt + prevlen, buf->pos.line->txt); old_line = buf->pos.line; buf->pos.line = buf->pos.line->prev; buf->linenum--; buf->pos.line->next = old_line->next; if (old_line->next != NULL) old_line->next->prev = buf->pos.line; if (buf->scrollpos == old_line) { buf->scrollpos = buf->pos.line; buf->scrollnum--; } free (old_line->txt); free (old_line); set_scr_col (buf); buf->modified = 1; refresh_banner = 1; refresh_text = 1; } buf->preferred_col = buf->scr_col; } else { del_char (buf); buf->modified = 1; refresh_text = 1; refresh_banner = 1; } check_scrolling (buf); VALID_STATE (buf->pos.line, buf->linenum); } /* Delete the character after the cursor */ static void key_delete (buffer * buf) { is_killing = 0; if (buf->pos.col == LINELEN (buf->pos)) { if (buf->pos.line->next == NULL) SLtt_beep (); else { int curlen, reqlen; buf_line *old_line; curlen = LINELEN (buf->pos); reqlen = curlen + buf->pos.line->next->txt_len; if (buf->pos.line->txt_len < reqlen) { char *nbuf; nbuf = (char *) realloc (buf->pos.line->txt, reqlen); if (nbuf == NULL) { mbuf_tell (buf, strerror (ENOMEM)); SLtt_beep (); return; } buf->pos.line->txt = nbuf; buf->pos.line->txt_len = reqlen; } strcat (buf->pos.line->txt + curlen, buf->pos.line->next->txt); old_line = buf->pos.line->next; buf->pos.line->next = old_line->next; if (old_line->next != NULL) old_line->next->prev = buf->pos.line; free (old_line->txt); free (old_line); buf->modified = 1; refresh_text = 1; refresh_banner = 1; } } else { char *p; p = buf->pos.line->txt + buf->pos.col; while (*p != '\0') { *p = *(p + 1); p++; } buf->modified = 1; refresh_text = 1; refresh_banner = 1; } VALID_STATE (buf->pos.line, buf->linenum); } /* Break the current line at the cursor position and insert a new line of text * below it... (that is, same thing enter generally does) */ static void key_enter (buffer * buf) { buf_line *line; is_killing = 0; line = (buf_line *) malloc (sizeof (buf_line)); if (line == NULL) { mbuf_tell (buf, strerror (ENOMEM)); SLtt_beep (); return; } line->txt_len = buf->pos.line->txt_len - buf->pos.col; line->txt = (char *) malloc (line->txt_len); if (line->txt == NULL) { free (line); mbuf_tell (buf, strerror (ENOMEM)); SLtt_beep (); return; } line->next = buf->pos.line->next; line->prev = buf->pos.line; line->prev->next = line; if (line->next != NULL) line->next->prev = line; strcpy (line->txt, buf->pos.line->txt + buf->pos.col); buf->pos.line->txt[buf->pos.col] = '\0'; buf->pos.line = line; buf->linenum++; buf->pos.col = 0; buf->scr_col = 0; buf->preferred_col = 0; check_scrolling (buf); if ((buf->autoindent == 1) && (!SLang_input_pending (0))) { if (buf->mode.indent) { if ((*buf->mode.indent) (buf, '\n')) { mbuf_tell (buf, "Error in indent"); SLtt_beep (); } } else { def_indent (buf, '\n'); } } buf->modified = 1; refresh_text = 1; refresh_banner = 1; VALID_STATE (buf->pos.line->prev, buf->linenum - 1); } /* Delete the current line of text, and add it to the killbuf to be inserted * elsewhere (or not). */ static void key_kill (buffer * buf) { buf_line **iter; if (!is_killing) { /* clear out the kill buffer */ while (killbuf != NULL) { buf_line *t; t = killbuf; killbuf = killbuf->next; free (t->txt); free (t); } } if (buf->pos.line->next == NULL) { if (LINELEN (buf->pos) == 0) { SLtt_beep (); return; } else { /* Allocate a new, empty line to tack onto the end of the buffer. * * This is done so that the kill can proceed as most users would * * expect it to -- by deleting the current line and leaving it * * blank. */ buf_line *nline; nline = (buf_line *) malloc (sizeof (buf_line)); if (nline == NULL) { mbuf_tell (buf, strerror (ENOMEM)); SLtt_beep (); return; } nline->next = NULL; nline->prev = buf->pos.line; nline->txt_len = 1; nline->txt = (char *) malloc (1); if (nline->txt == NULL) { free (nline); mbuf_tell (buf, strerror (ENOMEM)); SLtt_beep (); return; } nline->txt[0] = '\0'; buf->pos.line->next = nline; } } iter = &killbuf; while (*iter != NULL) iter = &((*iter)->next); *iter = buf->pos.line; if (buf->pos.line->prev != NULL) buf->pos.line->prev->next = buf->pos.line->next; else buf->text = buf->pos.line->next; if (buf->scrollpos == buf->pos.line) buf->scrollpos = buf->pos.line->next; buf->pos.line->next->prev = buf->pos.line->prev; buf->pos.line = buf->pos.line->next; (*iter)->prev = NULL; (*iter)->next = NULL; check_col (buf); check_scrolling (buf); is_killing = 1; buf->modified = 1; refresh_text = 1; refresh_banner = 1; VALID_STATE (buf->pos.line->prev, buf->linenum - 1); } /* Insert the contents of the killbuf before the current line of text. */ static void key_yank (buffer * buf) { /* The only tricky part is that we need to build the block to insert * first, * and then stick it in there as a whole. This ensures that if * lpe runs * out of memory in the middle, the buffer will still be * intact. */ buf_line *srciter, **dstiter; buf_line *lines, *end; int numlines; is_killing = 0; lines = NULL; end = NULL; dstiter = &lines; numlines = 0; for (srciter = killbuf; srciter != NULL; srciter = srciter->next) { buf_line *nline; nline = (buf_line *) malloc (sizeof (buf_line)); if (nline == NULL) { buf_line *iter; for (iter = lines; (iter != buf->pos.line) && (iter != NULL);) { buf_line *t; t = iter->next; free (iter->txt); free (iter); iter = t; } mbuf_tell (buf, strerror (ENOMEM)); SLtt_beep (); return; } nline->txt = (char *) malloc (srciter->txt_len); if (nline->txt == NULL) { buf_line *iter; for (iter = lines; (iter != buf->pos.line) && (iter != NULL);) { buf_line *t; t = iter->next; free (iter->txt); free (iter); iter = t; } free (nline); mbuf_tell (buf, strerror (ENOMEM)); SLtt_beep (); return; } nline->txt_len = srciter->txt_len; strcpy (nline->txt, srciter->txt); nline->next = buf->pos.line; nline->prev = end; if (nline->prev != NULL) { nline->prev->next = nline; } end = nline; *(dstiter) = nline; dstiter = &(nline->next); numlines++; } if (lines != NULL) { if (buf->state_valid_num >= buf->linenum) { lines->start_state = buf->pos.line->start_state; buf->state_valid = lines; buf->state_valid_num = buf->linenum; } lines->prev = buf->pos.line->prev; if (buf->scrollpos == buf->pos.line) buf->scrollpos = lines; if (lines->prev == NULL) buf->text = lines; else lines->prev->next = lines; buf->pos.line->prev = end; buf->linenum += numlines; check_scrolling (buf); check_col (buf); buf->modified = 1; refresh_text = 1; refresh_banner = 1; } else SLtt_beep (); } /* Save the buffer to an alternate file name. This command differs from the * traditional Windows-style "save as" command because the buffer keeps its * current name, but is simply saved to the alternate file name. Additionally, * if the previous buffer was modified it remains marked modified. This is by * design, because an lpe process is supposed to remain associated with a * specific file. If the user wants to edit the new file, they are welcome to * open the file after saving to it. */ static void key_save_alt (buffer * buf) { char *newname, *oldname; int mod_save; is_killing = 0; newname = wrap_mbuf_ask (buf, _("file: "), MBUF_FILE_COMPL); if ((newname == NULL) || (newname[0] == '\0')) return; oldname = buf->fname; mod_save = buf->modified; buf->fname = newname; if (save_buffer (buf) == -1) { mbuf_tell (buf, strerror (errno)); SLtt_beep (); } else mbuf_tell (buf, _("File saved successfully")); buf->fname = oldname; buf->modified = mod_save; } /* Save the buffer to disk */ static void key_save (buffer * buf) { is_killing = 0; if (!buf->fname_valid) { key_save_alt(buf); return; } if (save_buffer (buf) == -1) { mbuf_tell (buf, strerror (errno)); SLtt_beep (); } else mbuf_tell (buf, _("File saved successfully")); } /* Open a new file in the buffer, replacing the one that is there currently. * This command saves the killbuf, so that text can be cut from one file and * inserted into another with ease. Note that the command will fail if the * current buffer is modified. To open a file in this case, the user must * either save changes to the current buffer, or explicitly tell the editor to * forget them. This is by design, in a conscious attempt to avoid a prompt * in the minibuffer asking whether to save changes. */ static void key_open (buffer * buf) { static char open_fname[100]; is_killing = 0; if (buf->modified) { mbuf_tell (buf, _("Current buffer modified")); SLtt_beep (); } else { char *fname; buffer nbuf; fname = wrap_mbuf_ask (buf, _("file: "), MBUF_FILE_COMPL); if ((fname == NULL) || (fname[0] == '\0')) return; strcpy (open_fname, fname); if (open_buffer (&nbuf, open_fname, NULL) == -1) { mbuf_tell (buf, strerror (errno)); SLtt_beep (); return; } if (buf->mode.leave) (*buf->mode.leave) (buf); close_buffer (buf); /* Make the new buffer the open buffer */ if (nbuf.mode.enter) (*nbuf.mode.enter) (buf); nbuf.next = buf->next; nbuf.prev = buf->prev; memcpy (buf, &nbuf, sizeof (buffer)); refresh_text = 1; refresh_banner = 1; } } /* Save and quit the editor in one keystroke. */ static void key_exit (buffer * buf) { int err = 0; buffer *node; is_killing = 0; node = the_buf; do { if (!node) break; if (node->fname_valid) { if (save_buffer(node) == -1) err = 1; } node = node->next; } while (node != the_buf); if (err) { mbuf_tell (buf, strerror (errno)); SLtt_beep (); } else quit = 1; } /* change buffers */ static void key_nextbuf() { if (the_buf->mode.leave) (*the_buf->mode.leave)(the_buf); the_buf = the_buf->next; if (the_buf->mode.enter) (*the_buf->mode.enter)(the_buf); refresh_complete = 1; draw_screen(the_buf); } static void key_prevbuf() { if (the_buf->mode.leave) (*the_buf->mode.leave)(the_buf); the_buf = the_buf->prev; if (the_buf->mode.enter) (*the_buf->mode.enter)(the_buf); refresh_complete = 1; draw_screen(the_buf); } /* load a file into a new buffer */ static void key_openbuf() { char *fname; buffer *new = malloc(sizeof(buffer)); if (new == NULL) { mbuf_tell(the_buf, strerror(ENOMEM)); SLtt_beep(); return; } memset(new, 0, sizeof(buffer)); fname = wrap_mbuf_ask(the_buf, _("file: "), MBUF_FILE_COMPL); if ((fname == NULL) || (fname[0] == '\0')) { free(new); return; } if (open_buffer(new, fname, NULL) == -1) { mbuf_tell(the_buf, strerror(errno)); SLtt_beep(); free(new); return; } if (the_buf->mode.leave) (*the_buf->mode.leave)(the_buf); new->next = the_buf->next; new->prev = the_buf; the_buf->next->prev = new; the_buf->next = new; the_buf = the_buf->next; if (the_buf->mode.enter) (*the_buf->mode.enter)(the_buf); refresh_complete = 1; draw_screen(the_buf); } /* close and free the current buffer */ static void key_closebuf() { buffer *node; if (the_buf->next == the_buf) { mbuf_tell(the_buf, "Cannot close last buffer"); SLtt_beep(); return; } if (the_buf->mode.leave) (*the_buf->mode.leave)(the_buf); close_buffer(the_buf); the_buf->next->prev = the_buf->prev; the_buf->prev->next = the_buf->next; node = the_buf; the_buf = the_buf->next; free(node); refresh_complete = 1; draw_screen(the_buf); } /* Search for the given string forward in the buffer. If found, move the * cursor to the next occurrence of the string. */ static void key_search (buffer * buf, int parent_key) { static char str[50] = ""; char *search_str; int col_start; buf_line *iter; int lines_forward; is_killing = 0; buf->preferred_col = buf->scr_col; search_str = str; if (parent_key == LPE_SEARCH_KEY || *search_str == '\0') { search_str = wrap_mbuf_ask (buf, _("search term: "), MBUF_NO_COMPL); if ((search_str == NULL) || (*search_str == '\0')) return; strcpy (str, search_str); } if (buf->pos.line->txt[buf->pos.col] == '\0') { iter = buf->pos.line->next; lines_forward = 1; col_start = 0; } else { iter = buf->pos.line; lines_forward = 0; col_start = buf->pos.col + 1; } while (iter != NULL) { char *result; result = strstr (iter->txt + col_start, search_str); if (result == NULL) { iter = iter->next; lines_forward++; col_start = 0; } else { buf->pos.line = iter; buf->linenum += lines_forward; buf->pos.col = result - iter->txt; set_scr_col (buf); buf->preferred_col = buf->scr_col; mbuf_tell (buf, _("Found")); if (check_scrolling (buf)) refresh_text = 1; refresh_banner = 1; return; } } mbuf_tell (buf, _("Not found")); SLtt_beep (); refresh_banner = 1; } /* Move the cursor to the line number specified in the minibuf. */ static void key_gotoln (buffer * buf) { int i, ln, diff, back; char *ans, *end; buf_line *line; is_killing = 0; ans = wrap_mbuf_ask (buf, _("line: "), MBUF_NO_COMPL); if ((ans == NULL) || (ans[0] == '\0')) return; ln = strtol (ans, &end, 10) - 1; if (*end != '\0') { SLtt_beep (); return; } diff = ln - buf->linenum; back = 0; if (diff < 0) { diff = -diff; back = 1; } line = buf->pos.line; if (back) { for (i = 0; i < diff; i++) { if (line->prev == NULL) { SLtt_beep (); return; } else line = line->prev; } } else { for (i = 0; i < diff; i++) { if (line->next == NULL) { SLtt_beep (); return; } else line = line->next; } } buf->pos.line = line; buf->linenum += (back ? -diff : diff); check_col (buf); if (check_scrolling (buf)) refresh_text = 1; refresh_banner = 1; } /* Read the contents of a file into the current buffer, inserting it at the * cursor position. */ static void key_read_file (buffer * buf) { FILE *fp; char *fname; buf_line *new_text, *iter; int err_save, nlines; int lneeded; int llen, i; is_killing = 0; fname = wrap_mbuf_ask (buf, _("file: "), MBUF_FILE_COMPL); if ((fname == NULL) || (fname[0] == '\0')) return; fp = fopen (fname, "r"); if (fp == NULL) { mbuf_tell (buf, strerror (errno)); SLtt_beep (); return; } flock (fileno (fp), LOCK_SH); new_text = read_stream (fp); err_save = errno; flock (fileno (fp), LOCK_UN); fclose (fp); if (new_text == NULL) { mbuf_tell (buf, strerror (err_save)); SLtt_beep (); return; } /* At this point I'm sure enough it's gonna work to invalidate the DFA */ VALID_STATE (buf->pos.line, buf->linenum); /* Count the number of lines in the new file. This is needed to update * * buf->linenum; it's also very ugly and inefficient compared to tracking * * as the file is read, so I should really change read_stream to return * * this information in an output parameter. I wrote this so as to leave * * iter pointing to the last line; I'll use that in a sec. */ nlines = 0; for (iter = new_text; iter->next != NULL; iter = iter->next) nlines++; /* break the current line at the cursor point and insert the text in * there. */ llen = strlen (iter->txt); lneeded = buf->pos.line->txt_len - buf->pos.col + llen; if (iter->txt_len < lneeded) { char *ntxt; ntxt = (char *) realloc (iter->txt, lneeded); if (ntxt == NULL) { mbuf_tell (buf, strerror (ENOMEM)); SLtt_beep (); free_list (new_text); return; } iter->txt = ntxt; iter->txt_len = lneeded; } /* This just barely works with aliasing by one-line files; we just * * increased iter->txt_len (in that case aka, new_text->txt_len) to the * * required length after buf->pos.col, so adding buf->pos.col to that is * * the right thing to do. */ lneeded = buf->pos.col + new_text->txt_len; if (buf->pos.line->txt_len < lneeded) { char *ntxt; ntxt = (char *) realloc (buf->pos.line->txt, lneeded); if (ntxt == NULL) { mbuf_tell (buf, strerror (ENOMEM)); SLtt_beep (); free_list (new_text); return; } buf->pos.line->txt = ntxt; buf->pos.line->txt_len = lneeded; } strcpy (iter->txt + llen, buf->pos.line->txt + buf->pos.col); strcpy (buf->pos.line->txt + buf->pos.col, new_text->txt); iter->next = buf->pos.line->next; if (iter->next != NULL) iter->next->prev = iter; buf->pos.line->next = new_text->next; if (new_text->next != NULL) new_text->next->prev = buf->pos.line; for (i = 0; i < nlines; i++) { buf->pos.line = buf->pos.line->next; buf->pos.col = 0; } buf->linenum += nlines; buf->pos.col += llen; set_scr_col (buf); buf->preferred_col = buf->scr_col; buf->modified = 1; check_scrolling (buf); refresh_text = 1; refresh_banner = 1; } /* Clear the buffer modified flag. This represents a particular design * strategy for lpe. Instead of confirming an operation that would discard a * modified buffer, the operation should simply fail. If the user wants to * do so anyway, he/she simply tells the editor to forget changes and then * retries. */ static void key_clearmod (buffer * buf) { is_killing = 0; if (buf->modified) { buf->modified = 0; refresh_banner = 1; } } /* Move to the beginning of the entire buffer */ static void key_buf_start (buffer * buf) { is_killing = 0; buf->scrollpos = buf->text; buf->scrollnum = 0; buf->scrollcol = 0; buf->pos.line = buf->text; buf->pos.col = 0; buf->scr_col = 0; buf->linenum = 0; buf->preferred_col = 0; refresh_text = 1; refresh_banner = 1; } /* Move to the end of the entire buffer */ static void key_buf_end (buffer * buf) { is_killing = 0; while (buf->pos.line->next != NULL) { buf->pos.line = buf->pos.line->next; buf->linenum++; } buf->pos.col = strlen (buf->pos.line->txt); set_scr_col (buf); buf->preferred_col = buf->scr_col; if (check_scrolling (buf)) refresh_text = 1; refresh_banner = 1; } /* Switch tab handling behaviors between hard and soft tabs */ static void key_tab_swap (buffer * buf) { is_killing = 0; if (buf->hardtab) { buf->hardtab = 0; mbuf_tell (buf, _("Using soft tabs")); } else { buf->hardtab = 1; mbuf_tell (buf, _("Using hard tabs")); } } /* Respond to a keystroke by inserting that key in the buffer */ static void key_typed (int c, buffer * buf) { is_killing = 0; if (add_char (c, buf)) { mbuf_tell (buf, strerror (ENOMEM)); SLtt_beep (); return; } buf->modified = 1; if ((!SLang_input_pending (0)) && (buf->autoindent == 1)) { if (buf->mode.indent) { if ((*buf->mode.indent) (buf, c)) { mbuf_tell (buf, "Error in indent"); SLtt_beep (); } } else { def_indent (buf, c); } } check_scrolling (buf); refresh_text = 1; refresh_banner = 1; VALID_STATE (buf->pos.line, buf->linenum); if ((buf->mode.flashbrace != NULL) && !SLang_input_pending (0) && buf->flashbrace) { int col_save; int scr_col_save; buf_line *line_save; int linenum_save; int ret; col_save = buf->pos.col; scr_col_save = buf->scr_col; line_save = buf->pos.line; linenum_save = buf->linenum; ret = (*buf->mode.flashbrace) (buf); if (ret == 1) { if ((buf->scr_col >= buf->scrollcol) && (buf->scr_col < buf->scrollcol + SLtt_Screen_Cols)) { draw_screen (buf); SLang_input_pending (cfg_get_global_int_with_default ("flash_time", DEF_FLASH_TIME)); } } buf->pos.col = col_save; buf->scr_col = scr_col_save; buf->pos.line = line_save; buf->linenum = linenum_save; if (ret == -1) mbuf_tell (buf, _("Mismatched braces")); } } /* Insert spaces for a soft tab */ static void key_soft_tab (buffer * buf) { int nblanks, i; is_killing = 0; nblanks = next_mult (buf->scr_col, DEF_SOFT_TAB_WIDTH); for (i = 0; i < nblanks; i++) add_char (' ', buf); check_scrolling (buf); buf->modified = 1; refresh_text = 1; } /* Suspend the editor manually. This is required because S-Lang apparently has * decided to disable the Ctrl-Z key with no option to circumvent it. So lpe * must simulate this action by sending itself the SIGSTOP signal. */ static void key_suspend (buffer * buf) { cleanup_slang (); raise (SIGTSTP); init_slang (); } /* Toggle autoindent mode. */ static void key_ai_toggle (buffer * buf) { is_killing = 0; if (buf->autoindent) { buf->autoindent = 0; mbuf_tell (buf, _("Autoindent off")); } else { buf->autoindent = 1; mbuf_tell (buf, _("Autoindent on")); } } /* Get a number of commands for the command repeater */ static void key_rep (buffer * buf) { char *p; p = wrap_mbuf_ask (buf, _("count: "), MBUF_NO_COMPL); if ((p != NULL) && (*p != '\0')) cmd_repeat_count = atoi (p); cmd_repeat_command = 0; refresh_banner = 1; } /* Quickly quadruple the number of commands in the command repeater. This * allows the user to quickly enter a large number by hitting a key a few * times. For example, if the command repeater is clear, then hitting this key * will put 4 into it. Hitting the key again makes that 16. Again makes it * 64. A couple more times is 1024. This number grows exponentially, so it * should be easy to reach the general proximity of the desired value of * repetitions. */ static void key_rep_quad (buffer * buf) { if (cmd_repeat_count == 0) cmd_repeat_count = 4; else cmd_repeat_count *= 4; cmd_repeat_command = 0; refresh_banner = 1; } /* Start or stop the macro recorder. */ static void key_recorder (buffer * buf) { if (macro_recording) { mbuf_tell (buf, _("Macro recorder off")); macro_recording = 0; return; } mbuf_tell (buf, _("Macro recorder on")); macro_recording = 1; macro_nkeys = 0; macro_answer_len = 0; } /* Replay the keystrokes recorded by the macro recorder. If this command is * invoked while the recorder is recording, it stops the recorder before * replaying the sequence. */ static void key_playback (buffer * buf) { macro_recording = 0; if (macro_nkeys == 0) { SLtt_beep (); return; } else { macro_pos = 0; macro_answer_pos = 0; } } static void key_set_mode (buffer * buf) { char *reqname; reqname = wrap_mbuf_ask (buf, _("mode: "), MBUF_MODE_COMPL); if ((reqname == NULL) || (reqname[0] == '\0')) return; if (buf->mode.leave != NULL) (*buf->mode.leave) (buf); if (buf->mode.uninit != NULL) (*buf->mode.uninit) (buf); set_buf_mode (buf, reqname); if (buf->mode.enter != NULL) (*buf->mode.enter) (buf); refresh_text = 1; refresh_banner = 1; } /* To avoid a nasty deadlock, we actually need to fork twice: once for the * writing process and again for the stream manipulation command itself. */ static buf_line * stream_manip (buf_line * txt, char *cmd, char *args[]) { int pipes[2][2], status; FILE *fp; pid_t child, writer; buf_line *new_text; pipe (pipes[0]); pipe (pipes[1]); if ((writer = fork ()) == 0) { FILE *fp; close (pipes[0][0]); close (pipes[1][0]); close (pipes[1][1]); fp = fdopen (pipes[0][1], "w"); if (fp == NULL) { close (pipes[0][1]); exit (1); } write_stream (fp, txt); fclose (fp); exit (0); } else if (writer < 0) { close (pipes[0][0]); close (pipes[0][1]); close (pipes[1][0]); close (pipes[1][1]); return NULL; } if ((child = fork ()) == 0) { int fderr; close (pipes[0][1]); close (pipes[1][0]); dup2 (pipes[0][0], 0); dup2 (pipes[1][1], 1); /* Redirect standard error to /dev/null */ fderr = open ("/dev/null", O_WRONLY); dup2 (fderr, 2); execvp (cmd, args); exit (1); } else if (child < 0) { kill (writer, SIGKILL); waitpid (writer, NULL, 0); close (pipes[0][0]); close (pipes[0][1]); close (pipes[1][0]); close (pipes[1][1]); return NULL; } close (pipes[0][0]); close (pipes[0][1]); close (pipes[1][1]); fp = fdopen (pipes[1][0], "r"); if (fp == NULL) { kill (writer, SIGKILL); waitpid (writer, NULL, 0); kill (child, SIGKILL); waitpid (child, NULL, 0); close (pipes[1][0]); return NULL; } new_text = read_stream (fp); fclose (fp); if (new_text == NULL) { kill (writer, SIGKILL); waitpid (writer, NULL, 0); kill (child, SIGKILL); waitpid (child, NULL, 0); return NULL; } waitpid (writer, &status, 0); if (!WIFEXITED (status) || (WEXITSTATUS (status) != 0)) { kill (child, SIGKILL); waitpid (child, NULL, 0); free_list (new_text); return NULL; } waitpid (child, &status, 0); if (!WIFEXITED (status) || (WEXITSTATUS (status) != 0)) { free_list (new_text); return NULL; } return new_text; } /* Pass the current buffer through the specified shell command as a stream, and * replace the buffer with the output if the shell command succeeds. */ static void key_shell (buffer * buf) { char *args[4]; buf_line *new_text; args[0] = cfg_get_global_string_with_default ("shell_command", CMD_SH); args[1] = "-c"; args[2] = wrap_mbuf_ask (buf, _("shell: "), MBUF_NO_COMPL); args[3] = NULL; if ((args[2] == NULL) || (args[2][0] == '\0')) return; new_text = stream_manip (buf->text, args[0], args); if (new_text == NULL) { mbuf_tell (buf, _("Command failed")); SLtt_beep (); return; } free_list (buf->text); buf->text = new_text; buf->scrollpos = buf->pos.line = buf->text; buf->scrollnum = buf->linenum = 0; buf->scrollcol = buf->scr_col = buf->preferred_col = buf->pos.col = 0; buf->text->start_state = 0; buf->state_valid = buf->text; buf->state_valid_num = 0; buf->modified = 1; refresh_text = 1; refresh_banner = 1; } /* Pass the current buffer through an awk script entered from the minibuf, * and replace the buffer with the output if awk succeeds. */ static void key_awk (buffer * buf) { char *args[3]; buf_line *new_text; args[0] = cfg_get_global_string_with_default ("awk_command", CMD_AWK); args[1] = wrap_mbuf_ask (buf, _("awk: "), MBUF_NO_COMPL); args[2] = NULL; if ((args[1] == NULL) || (args[1][0] == '\0')) return; new_text = stream_manip (buf->text, args[0], args); if (new_text == NULL) { mbuf_tell (buf, _("Command failed")); SLtt_beep (); return; } free_list (buf->text); buf->text = new_text; buf->scrollpos = buf->pos.line = buf->text; buf->scrollnum = buf->linenum = 0; buf->scrollcol = buf->scr_col = buf->preferred_col = buf->pos.col = 0; buf->text->start_state = 0; buf->state_valid = buf->text; buf->state_valid_num = 0; buf->modified = 1; refresh_text = 1; refresh_banner = 1; } /* Pass the current buffer through a sed script entered from the minibuf, * and replace the buffer with the output if sed succeeds. */ static void key_sed (buffer * buf) { char *args[3]; buf_line *new_text; args[0] = cfg_get_global_string_with_default ("sed_command", CMD_SED); args[1] = wrap_mbuf_ask (buf, _("sed: "), MBUF_NO_COMPL); args[2] = NULL; if ((args[1] == NULL) || (args[1][0] == '\0')) return; new_text = stream_manip (buf->text, args[0], args); if (new_text == NULL) { mbuf_tell (buf, _("Command failed")); SLtt_beep (); return; } free_list (buf->text); buf->text = new_text; buf->scrollpos = buf->pos.line = buf->text; buf->scrollnum = buf->linenum = 0; buf->scrollcol = buf->scr_col = buf->preferred_col = buf->pos.col = 0; buf->text->start_state = 0; buf->state_valid = buf->text; buf->state_valid_num = 0; buf->modified = 1; refresh_text = 1; refresh_banner = 1; } /* Pass a range of lines of the current buffer through the specified shell * command as a stream. The range begins at the current line and ends n lines * forward, where n is the number in the command repeater. This is blatant * abuse of the repeater, but it's the most intuitive way I can find to design * the interface. */ static void key_shell_ln (buffer * buf) { char *args[4]; buf_line *new_text; buf_line *last_before, *first_after, *txt; /* unlink the lines from the buffer so that stream_manip doesn't exceed * * the desired range. */ last_before = buf->pos.line->prev; txt = buf->pos.line; txt->prev = NULL; if (cmd_repeat_count == 0) cmd_repeat_count = 1; first_after = txt; while ((first_after) && (cmd_repeat_count > 0)) { first_after = first_after->next; cmd_repeat_count--; } if (first_after) first_after->prev->next = NULL; /* do the command */ args[0] = cfg_get_global_string_with_default ("shell_command", CMD_SH); args[1] = "-c"; args[2] = wrap_mbuf_ask (buf, _("shell: "), MBUF_NO_COMPL); args[3] = NULL; if ((args[2] == NULL) || (args[2][0] == '\0')) return; new_text = stream_manip (txt, args[0], args); if (new_text == NULL) { mbuf_tell (buf, _("Command failed")); SLtt_beep (); return; } new_text->start_state = buf->pos.line->start_state; VALID_STATE (new_text, buf->linenum); /* relink the lines back into the buffer */ if (buf->scrollpos == buf->pos.line) buf->scrollpos = new_text; buf->pos.line = new_text; if (last_before) { last_before->next = new_text; new_text->prev = last_before; } else { buf->text = new_text; new_text->prev = NULL; } while (new_text->next != NULL) { buf->linenum++; new_text = new_text->next; } new_text->next = first_after; if (first_after) { buf->linenum++; first_after->prev = new_text; buf->pos.line = first_after; buf->pos.col = buf->scr_col = buf->preferred_col = 0; } else { buf->pos.line = new_text; buf->pos.col = strlen (new_text->txt); set_scr_col (buf); buf->preferred_col = buf->scr_col; } free_list (txt); check_scrolling (buf); buf->modified = 1; refresh_text = 1; refresh_banner = 1; } static void key_awk_ln (buffer * buf) { char *args[3]; buf_line *new_text; buf_line *last_before, *first_after, *txt; /* unlink the lines from the buffer so that stream_manip doesn't exceed * * the desired range. */ last_before = buf->pos.line->prev; txt = buf->pos.line; txt->prev = NULL; if (cmd_repeat_count == 0) cmd_repeat_count = 1; first_after = txt; while ((first_after) && (cmd_repeat_count > 0)) { first_after = first_after->next; cmd_repeat_count--; } if (first_after) first_after->prev->next = NULL; /* do the command */ args[0] = cfg_get_global_string_with_default ("awk_command", CMD_AWK); args[1] = wrap_mbuf_ask (buf, _("awk: "), MBUF_NO_COMPL); args[2] = NULL; if ((args[1] == NULL) || (args[1][0] == '\0')) return; new_text = stream_manip (txt, args[0], args); if (new_text == NULL) { mbuf_tell (buf, _("Command failed")); SLtt_beep (); return; } new_text->start_state = buf->pos.line->start_state; VALID_STATE (new_text, buf->linenum); /* relink the lines back into the buffer */ if (buf->scrollpos == buf->pos.line) buf->scrollpos = new_text; buf->pos.line = new_text; if (last_before) { last_before->next = new_text; new_text->prev = last_before; } else { buf->text = new_text; new_text->prev = NULL; } while (new_text->next != NULL) { buf->linenum++; new_text = new_text->next; } new_text->next = first_after; if (first_after) { buf->linenum++; first_after->prev = new_text; buf->pos.line = first_after; buf->pos.col = buf->scr_col = buf->preferred_col = 0; } else { buf->pos.line = new_text; buf->pos.col = strlen (new_text->txt); set_scr_col (buf); buf->preferred_col = buf->scr_col; } free_list (txt); check_scrolling (buf); buf->modified = 1; refresh_text = 1; refresh_banner = 1; } static void key_sed_ln (buffer * buf) { char *args[3]; buf_line *new_text; buf_line *last_before, *first_after, *txt; /* unlink the lines from the buffer so that stream_manip doesn't exceed * * the desired range. */ last_before = buf->pos.line->prev; txt = buf->pos.line; txt->prev = NULL; if (cmd_repeat_count == 0) cmd_repeat_count = 1; first_after = txt; while ((first_after) && (cmd_repeat_count > 0)) { first_after = first_after->next; cmd_repeat_count--; } if (first_after) first_after->prev->next = NULL; /* do the command */ args[0] = cfg_get_global_string_with_default ("sed_command", CMD_SED); args[1] = wrap_mbuf_ask (buf, _("sed: "), MBUF_NO_COMPL); args[2] = NULL; if ((args[1] == NULL) || (args[1][0] == '\0')) return; new_text = stream_manip (txt, args[0], args); if (new_text == NULL) { mbuf_tell (buf, _("Command failed")); SLtt_beep (); return; } new_text->start_state = buf->pos.line->start_state; VALID_STATE (new_text, buf->linenum); /* relink the lines back into the buffer */ if (buf->scrollpos == buf->pos.line) buf->scrollpos = new_text; buf->pos.line = new_text; if (last_before) { last_before->next = new_text; new_text->prev = last_before; } else { buf->text = new_text; new_text->prev = NULL; } while (new_text->next != NULL) { buf->linenum++; new_text = new_text->next; } new_text->next = first_after; if (first_after) { buf->linenum++; first_after->prev = new_text; buf->pos.line = first_after; buf->pos.col = buf->scr_col = buf->preferred_col = 0; } else { buf->pos.line = new_text; buf->pos.col = strlen (new_text->txt); set_scr_col (buf); buf->preferred_col = buf->scr_col; } free_list (txt); check_scrolling (buf); buf->modified = 1; refresh_text = 1; refresh_banner = 1; } static void key_help (buffer * buf) { static buffer buf_save; buffer *buf_help; buf_help = get_helpbuf (); if (buf_help == NULL) { SLtt_beep (); return; } if (!is_help) { memcpy (&buf_save, buf, sizeof (buffer)); memcpy (buf, buf_help, sizeof (buffer)); refresh_text = refresh_banner = 1; is_help = 1; } else { memcpy (buf, &buf_save, sizeof (buffer)); refresh_text = refresh_banner = 1; is_help = 0; } } /* Perform some debug operation. This is a defined hook for useful debugging * commands and diagnostic information. It is meant to be used when debugging * the editor itself. */ static void key_debug (buffer * buf) { char *cmd; is_killing = 0; cmd = wrap_mbuf_ask (buf, _("debug: "), MBUF_NO_COMPL); if ((cmd == NULL) || (cmd[0] == '\0')) return; /* Eat all available memory, so that the next command that tries to * * allocate memory will fail. This is used to test response to out of * * memory problems. This is not recommended in normal practice. :-) */ if (strcmp (cmd, "memtest") == 0) { while (malloc (1) != NULL) ; refresh_banner = 1; } else { mbuf_tell (buf, _("Unknown debug request")); SLtt_beep (); } } static void key_slang (buffer * buf) { char *cmd; is_killing = 0; cmd = wrap_mbuf_ask (buf, _("command: "), MBUF_NO_COMPL); if ((cmd == NULL) || (cmd[0] == '\0')) return; SLang_load_string (cmd); /* to avoid slang stack overflows... */ SLang_restart (1); SLang_set_error(0); /* * This is not the nicest thing to do, but certain slang commnds, * such as printf ( "\033];A New XTerm title\007\n" ); leave trash * behind, that must be cleared. * - Gergely Nagy */ refresh_complete = 1; } /* The main input processing loop. Reads keys and dispatches them to the * appropriate handler function described above. */ void process_input (buffer * buf) { int c; /* Read a key. This is complicated for two reasons: first, the command * * repeater. And second, the macro recorder. Both might be sources of * * characters other than the keyboard. And they interact with each other * * in interesting ways. * * To keep things sane, the macro recorder does * NOT record command repeater * commands. Instead, it actually records * the result from the command * repeater as a series of keystrokes. On * the other hand, the repeater * will repeat playback commands in full. * It won't just repeat the first * keystroke. This is necessary for the * macro recorder to be of any real * use. :-) */ if (macro_rep_save != -1) { cmd_repeat_count = macro_rep_save; macro_rep_save = -1; } if (macro_pos >= macro_nkeys) macro_pos = -1; if (macro_pos == -1) { if ((cmd_repeat_count == 0) || (cmd_repeat_command == 0)) { public_repeat_count = cmd_repeat_count; if (!SLang_input_pending (0)) draw_screen (buf); if (the_mbuf.vis) { the_mbuf.vis = 0; refresh_banner = 1; } c = SLkp_getkey (); if (cmd_repeat_count > 0) { if ((c != LPE_REP_KEY) && (c != LPE_REP_QUAD_KEY) && (c != LPE_SHELL_LN_KEY) && (c != LPE_AWK_LN_KEY) && (c != LPE_SED_LN_KEY)) { cmd_repeat_command = c; cmd_repeat_count--; } } } else { c = cmd_repeat_command; cmd_repeat_count--; } } else { c = macro_keys[macro_pos]; macro_rep_save = cmd_repeat_count; cmd_repeat_count = macro_reps[macro_pos]; macro_pos++; } if ((macro_recording) && (c != LPE_PLAYBACK_KEY) && (c != LPE_RECORDER_KEY) && (c != LPE_REP_KEY) && (c != LPE_REP_QUAD_KEY)) { if (macro_nkeys == MAX_MACRO_KEYS) { mbuf_tell (buf, _("Macro overflow")); SLtt_beep (); macro_recording = 0; macro_nkeys = 0; } else { macro_keys[macro_nkeys] = c; macro_reps[macro_nkeys] = cmd_repeat_count; macro_nkeys++; } } if (SLKeyBoard_Quit) quit = 1; else switch (c) { case LPE_ERR_KEY: key_error (buf); break; case LPE_UP_KEY: key_up (buf); break; case LPE_DOWN_KEY: key_down (buf); break; case LPE_LEFT_KEY: key_left (buf); break; case LPE_RIGHT_KEY: key_right (buf); break; case LPE_PGUP_KEY: key_pgup (buf); break; case LPE_PGDN_KEY: key_pgdn (buf); break; case LPE_HOME_KEY: key_home (buf); break; case LPE_END_KEY: key_end (buf); break; case LPE_NEXT_WORD_KEY: key_next_word (buf); break; case LPE_PREV_WORD_KEY: key_prev_word (buf); break; case LPE_BACKSPACE_KEY: if (!buf->rdonly) key_backspace (buf); else SLtt_beep (); break; case LPE_DELETE_KEY: if (!buf->rdonly) key_delete (buf); else SLtt_beep (); break; case '\t': if (!buf->rdonly) { if (buf->hardtab) key_typed ('\t', buf); else key_soft_tab (buf); } else SLtt_beep (); break; case '\n': case '\r': case LPE_ENTER_KEY: if (!buf->rdonly) key_enter (buf); else SLtt_beep (); break; case LPE_OPEN_KEY: key_open (buf); break; case LPE_SAVE_KEY: key_save (buf); break; case LPE_SAVE_ALT_KEY: key_save_alt (buf); break; case LPE_EXIT_KEY: key_exit (buf); break; case LPE_KILL_KEY: if (!buf->rdonly) key_kill (buf); else SLtt_beep (); break; case LPE_YANK_KEY: if (!buf->rdonly) key_yank (buf); else SLtt_beep (); break; case LPE_SEARCH_KEY: key_search (buf, LPE_SEARCH_KEY); break; case LPE_FIND_NEXT_KEY: key_search (buf, LPE_FIND_NEXT_KEY); break; case LPE_GOTOLN_KEY: key_gotoln (buf); break; case LPE_READF_KEY: if (!buf->rdonly) key_read_file (buf); else SLtt_beep (); break; case LPE_CLEARMOD_KEY: key_clearmod (buf); break; case LPE_BUF_START_KEY: key_buf_start (buf); break; case LPE_BUF_END_KEY: key_buf_end (buf); break; case LPE_TAB_SWAP_KEY: key_tab_swap (buf); break; case LPE_REFRESH_KEY: refresh_complete = 1; break; case LPE_SUSPEND_KEY: key_suspend (buf); break; case LPE_AI_TOGGLE_KEY: key_ai_toggle (buf); break; case LPE_REP_KEY: key_rep (buf); break; case LPE_REP_QUAD_KEY: key_rep_quad (buf); break; case LPE_RECORDER_KEY: key_recorder (buf); break; case LPE_PLAYBACK_KEY: key_playback (buf); break; case LPE_SET_MODE_KEY: key_set_mode (buf); break; case LPE_SHELL_KEY: if (!buf->rdonly) key_shell (buf); else SLtt_beep (); break; case LPE_AWK_KEY: if (!buf->rdonly) key_awk (buf); else SLtt_beep (); break; case LPE_SED_KEY: if (!buf->rdonly) key_sed (buf); else SLtt_beep (); break; case LPE_SHELL_LN_KEY: if (!buf->rdonly) key_shell_ln (buf); else SLtt_beep (); break; case LPE_AWK_LN_KEY: if (!buf->rdonly) key_awk_ln (buf); else SLtt_beep (); break; case LPE_SED_LN_KEY: if (!buf->rdonly) key_sed_ln (buf); else SLtt_beep (); break; case LPE_HELP_KEY: key_help (buf); break; case LPE_NEXTBUF_KEY: if(is_help) key_help(buf); else key_nextbuf(); break; case LPE_PREVBUF_KEY: if(is_help) key_help(buf); else key_prevbuf(); break; case LPE_OPENBUF_KEY: if(is_help) key_help(buf); key_openbuf(); break; case LPE_CLOSEBUF_KEY: if(is_help) key_help(buf); else key_closebuf(); break; case LPE_DEBUG_KEY: key_debug (buf); break; case LPE_SLANG_KEY: key_slang (buf); break; default: /* If it's a special key, then the mode must have registered * it, * so pass it along. If not, then type it. */ if (c > 0x2000) { if (buf->mode.extkey != NULL) (*buf->mode.extkey) (buf, c); } else if (!buf->rdonly) key_typed (c, buf); else SLtt_beep (); break; } } lpe-1.2.7/src/mode-utils.h0000644000175000017500000000356107314070314014247 0ustar adammadamm/* mode-utils.h * * Copyright (c) 1999 Chris Smith * * Author: * Gergely Nagy * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #ifndef LPE_MODE_UTILS_H #define LPE_MODE_UTILS_H #include "cfg.h" #include "lpecomm.h" /** * mode_util_accept_extensions: accept only the specified extensions * @extension: the suffix (extension) of the filename * @case_sensitive: non-0 if the check should be case sensitive * @cnt: number of extensions specified as optional arguments * @optional_arguments: the extensions we want to accept * * This function makes it easy to check for filename suffixes, and if it is * in a list, then accept it. * * Returns 1 on success, 0 otherwise **/ int mode_util_accept_extensions ( char *extension, int case_sensitive, int cnt, ... ); /** * mode_util_accept_on_request: accept a file on request * @line: the line in which we perform the search * @case_sensitive: non-0 if the check should be case sensitive * @cnt: number of modes we specified as optional arguments * @optional_arguments: the list of modes we want to accept * * This function searches for -*- [mode] -*- and -*- Mode: [mode] -*- substrings * in a given line. * * Returns 1 on success, 0 otherwise **/ int mode_util_accept_on_request ( char *line, int case_sensitive, int cnt, ... ); void mode_util_set_slang_color ( char *mode, char *color_id, int sl_color_id, char *def_fg, char *def_bg ); void mode_util_set_options ( buffer *buf, char *mode, int hardtab, int autoindent, int offerhelp, int highlight, int flashbrace ); #define mode_util_get_option(mode,id) \ cfg_get_option_int ( mode, "general", id ) #define mode_util_get_option_with_default(mode,id,def) \ cfg_get_option_int_with_default ( mode, "general", id, def ) #endif /* ! LPE_MODE_UTILS_H */ lpe-1.2.7/src/highlight.h0000644000175000017500000000606207011613564014137 0ustar adammadamm/* highlight.h * * Copyright (c) 1999 Chris Smith * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #ifndef LPE_HIGHLIGHT_H #define LPE_HIGHLIGHT_H #include "options.h" /* These are some standard colors that should be used when appropriate by * syntax highlighters for various modules for programming languages. Modes * may, of course, define their own custom colors -- but these should be used * if they apply for the benefit of users attempting to customize coloring. * * Modes that include highlight.h for standard colors should use palette * entries starting at 128 for any extensions. This ensures that even as the * number of standard entries increases, there won't be any conflict between * palette indexes. */ /* Used for plain identifiers, such as variable or function names. */ #define COLOR_IDENT 0 #define COLOR_IDENT_FG "lightgray" #define COLOR_IDENT_BG "black" /* Used for any non-word symbols that are not covered by another special case * defined elsewhere. */ #define COLOR_SYMBOL 1 #define COLOR_SYMBOL_FG "white" #define COLOR_SYMBOL_BG "black" /* Used for symbols that must match, as in braces. They are highlighted so as * to make the structure of a line clear. */ #define COLOR_BRACE 2 #define COLOR_BRACE_FG "yellow" #define COLOR_BRACE_BG "black" /* Used for anything that is ignored by the compiler or interpreter for the * language. */ #define COLOR_COMMENT 3 #define COLOR_COMMENT_FG "green" #define COLOR_COMMENT_BG "black" /* Used for 'reserved words': any word that holds special meaning, such as * keywords, boolean constants, etc. */ #define COLOR_KEYWORD 4 #define COLOR_KEYWORD_FG "cyan" #define COLOR_KEYWORD_BG "black" /* Used for anything that is interpreted by a preprocessor -- this is somewhat * specific to C/C++, but I'm putting it here because perlmode also uses a * preprocessor color. */ #define COLOR_PREPROC 5 #define COLOR_PREPROC_FG "brown" #define COLOR_PREPROC_BG "black" /* Used for string constants of any type. */ #define COLOR_STRING 6 #define COLOR_STRING_FG "brightblue" #define COLOR_STRING_BG "black" /* Used for numerical constants of any type. */ #define COLOR_NUMBER 7 #define COLOR_NUMBER_FG "brightblue" #define COLOR_NUMBER_BG "black" /* Used for escaped characters in a string constant, to make it clear what a * '\' character applies to. */ #define COLOR_STRINGE 8 #define COLOR_STRINGE_FG "blue" #define COLOR_STRINGE_BG "black" /* Used for anything that the compiler will choke on at the lexical level, such * as a malformed numeric constant. */ #define COLOR_ILLEGAL 9 #define COLOR_ILLEGAL_FG "red" #define COLOR_ILLEGAL_BG "black" /* Used to indicate an internal error within the syntax highlighter. The * appearance of this color is always a bug. */ #define COLOR_DEBUG 10 #define COLOR_DEBUG_FG "yellow" #define COLOR_DEBUG_BG "red" #endif /* LPE_HIGHLIGHT_H */ lpe-1.2.7/src/lpe.h0000644000175000017500000000117707135316712012754 0ustar adammadamm/* lpe.h * * Copyright (c) 1999 Chris Smith * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #ifndef LPE_H #define LPE_H #include "i18n.h" /* * This is bad. very bad. but I need PATH_MAX for -pedantic -ansi. * It is defined in linux/limits.h, but that's Linux only, and I * don't have access to other systems, so can't detect it in * configure... * - Gergely Nagy */ #ifndef PATH_MAX #define PATH_MAX 255 #endif /* Flag to quit the application */ extern int quit; /* Prototypes for functions in lpe.c */ void die(char *s, ...); #endif /* LPE_H */ lpe-1.2.7/src/input.h0000644000175000017500000000456007136726431013336 0ustar adammadamm/* input.h * * Copyright (c) 1999 Chris Smith * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #ifndef LPE_INPUT_H #define LPE_INPUT_H #include SLANG_H #include "buffer.h" /* Constants to represent operations that can be bound to various keys */ #define LPE_ERR_KEY SL_KEY_ERR #define LPE_UP_KEY SL_KEY_UP #define LPE_DOWN_KEY SL_KEY_DOWN #define LPE_LEFT_KEY SL_KEY_LEFT #define LPE_RIGHT_KEY SL_KEY_RIGHT #define LPE_PGUP_KEY SL_KEY_PPAGE #define LPE_PGDN_KEY SL_KEY_NPAGE #define LPE_HOME_KEY SL_KEY_HOME #define LPE_END_KEY SL_KEY_END #define LPE_BACKSPACE_KEY SL_KEY_BACKSPACE #define LPE_DELETE_KEY SL_KEY_DELETE #define LPE_ENTER_KEY SL_KEY_ENTER #define LPE_OPEN_KEY 0x1001 #define LPE_SAVE_KEY 0x1002 #define LPE_SAVE_ALT_KEY 0x1003 #define LPE_EXIT_KEY 0x1004 #define LPE_KILL_KEY 0x1005 #define LPE_YANK_KEY 0x1006 #define LPE_SEARCH_KEY 0x1007 #define LPE_READF_KEY 0x1008 #define LPE_GOTOLN_KEY 0x1009 #define LPE_CLEARMOD_KEY 0x100A #define LPE_BUF_START_KEY 0x100B #define LPE_BUF_END_KEY 0x100C #define LPE_TAB_SWAP_KEY 0x100D #define LPE_REFRESH_KEY 0x100E #define LPE_SUSPEND_KEY 0x100F #define LPE_FIND_NEXT_KEY 0x1010 #define LPE_REP_KEY 0x1011 #define LPE_REP_QUAD_KEY 0x1012 #define LPE_NEXT_WORD_KEY 0x1013 #define LPE_PREV_WORD_KEY 0x1014 #define LPE_SET_MODE_KEY 0x1018 #define LPE_AI_TOGGLE_KEY 0x1015 #define LPE_RECORDER_KEY 0x1016 #define LPE_PLAYBACK_KEY 0x1017 #define LPE_SHELL_KEY 0x1019 #define LPE_AWK_KEY 0x101A #define LPE_SED_KEY 0x101B #define LPE_SHELL_LN_KEY 0x101C #define LPE_AWK_LN_KEY 0x101D #define LPE_SED_LN_KEY 0x101E #define LPE_HELP_KEY 0x101F #define LPE_NEXTBUF_KEY 0x1020 #define LPE_PREVBUF_KEY 0x1021 #define LPE_OPENBUF_KEY 0x1022 #define LPE_CLOSEBUF_KEY 0x1023 #define LPE_SLANG_KEY 0x1024 #define LPE_DEBUG_KEY 0x1FFF /* global variables holding the value of the command repeater */ extern int public_repeat_count; /* utility functions of potential use to modularized functions */ int next_mult(int now, int spacing); int check_scrolling(buffer *buf); void check_col(buffer *buf); void set_scr_col(buffer *buf); /* prototypes for input handling functions */ void process_input(buffer *buf); #endif /* LPE_INPUT_H */ lpe-1.2.7/src/common.c0000644000175000017500000000267510100312722013442 0ustar adammadamm/* * Copyright (c) 2004 Adam Majer * * This file may be distributed only udner the terms of the GPL license * version 2. See COPYING for further details. */ #include "common.h" #include #include #include #include int copy( const char *from_file, const char *to_file ) { int in, out; char buffer[8192]; struct stat buf; ssize_t size_read, total = 0; if(!( in = open( from_file, O_RDONLY ))) return -1; if(!( out = open( to_file, O_WRONLY | O_TRUNC ))){ close( in ); return -1; } if(!fstat( in, &buf )){ close( in ); unlink( to_file ); close( out ); return -1; } while((size_read = read( in, buffer, 8192 )) > -1 ){ total += size_read; if( write( out, buffer, size_read ) != size_read ){ unlink( to_file ); break; /* error, cannot write */ } if( total == buf.st_size ) /* copied the entire file */ break; if( size_read < 1 ){ unlink( to_file ); break; } } close( in ); /* attempt to set same mode and priv. as the source */ fchmod( out, buf.st_mode ); fchown( out, buf.st_uid, buf.st_gid ); close( out ); /* check if we have copied the file */ if( close( open( to_file, O_RDONLY ))) return 0; return -1; /* An error occured during copy */ } lpe-1.2.7/src/help.c0000644000175000017500000001347207136723716013127 0ustar adammadamm/* help.c * * Copyright (c) 1999 Chris Smith * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #include "options.h" #include "buffer.h" #include "help.h" #include "i18n.h" #include "cfg.h" #include #include buffer help_buf; int help_initialized = 0; int is_help = 0; static buf_line * read_string (char *p) { buf_line *start; buf_pos pos; start = (buf_line *) malloc (sizeof (buf_line)); if (start == NULL) { errno = ENOMEM; return NULL; } start->txt = (char *) malloc (1); if (start->txt == NULL) { free (start); errno = ENOMEM; return NULL; } start->txt[0] = '\0'; start->txt_len = 1; start->prev = NULL; start->next = NULL; pos.line = start; pos.col = 0; while (*p != '\0') { int c; c = *(p++); if (c == '\n') { buf_line *t; pos.line->txt[pos.col] = '\0'; t = (buf_line *) malloc (sizeof (buf_line)); if (t == NULL) { free_list (start); errno = ENOMEM; return NULL; } t->txt = (char *) malloc (1); if (t->txt == NULL) { free_list (start); free (t); errno = ENOMEM; return NULL; } pos.line->next = t; pos.line->next->txt_len = 1; pos.line->next->prev = pos.line; pos.line->next->next = NULL; pos.line = pos.line->next; pos.col = 0; } else { pos.line->txt[pos.col] = (char) c; if (++pos.col == pos.line->txt_len) { char *ntxt; ntxt = (char *) realloc (pos.line->txt, pos.line->txt_len + cfg_get_global_int_with_default ("realloc_granularity", DEF_REALLOC_GRAN)); if (ntxt == NULL) { free_list (start); errno = ENOMEM; return NULL; } pos.line->txt = ntxt; pos.line->txt_len += cfg_get_global_int_with_default ("realloc_granularity", DEF_REALLOC_GRAN); } } } return start; } static int init_helpbuf (void) { buffer *buf = &help_buf; char *help_text = _("Lpe: The Lightweight Programmer's Editor\n" "Help Screen\n" "\n" "Ctrl-Q -- Move cursor to beginning of line (alternative to Home)\n" "Ctrl-W -- Move cursor to end of line (alternative to End)\n" "Ctrl-R -- Scroll one screen up (alternative to PgUp)\n" "Ctrl-T -- Scroll one screen down (alternative to PgDn)\n" "Ctrl-O -- Move to the next word\n" "Ctrl-P -- Move to the previous word\n" "\n" "Ctrl-K -- Kill the current line\n" "Ctrl-Y or Ctrl-U -- Insert the most recent block of killed lines\n" "Ctrl-S -- Search for a specified string in the file\n" "Ctrl-A -- Search again for the last search query\n" "\n" "Ctrl-F Ctrl-O -- Open a new file to replace the current buffer\n" "Ctrl-F Ctrl-S -- Save the buffer to disk\n" "Ctrl-F Ctrl-A -- Save to disk with an alternate file name\n" "Ctrl-F Ctrl-R -- Read a file and insert it at the current cursor position\n" "Ctrl-F Ctrl-E -- Pretend that a buffer hasn't been modified\n" "Ctrl-F Ctrl-X -- Next buffer\n" "Ctrl-F Ctrl-Z -- Previous buffer\n" "Ctrl-F Ctrl-N -- Open a new buffer from a file\n" "Ctrl-F Ctrl-L -- Close current buffer\n" "\n" "Ctrl-B Ctrl-S -- Set the mode of the current buffer\n" "Ctrl-B Ctrl-T -- Toggle between hard and soft tabs for this buffer\n" "Ctrl-B Ctrl-A -- Toggle automatic indentation of this buffer\n" "\n" "Ctrl-G Ctrl-A -- Go to the first line of the buffer\n" "Ctrl-G Ctrl-S -- Go to the last line of the buffer\n" "Ctrl-G Ctrl-G -- Go to a specific line number of the buffer\n" "\n" "Ctrl-N Ctrl-R -- Enter a value for the command repeater\n" "Ctrl-N Ctrl-T -- Multiply the command repeater value by four\n" "Ctrl-N Ctrl-O -- Start or stop recording a macro\n" "Ctrl-N Ctrl-P -- Play back the last recorded macro\n" "\n" "Ctrl-V Ctrl-V -- Pass the entire buffer through a shell command\n" "Ctrl-V Ctrl-A -- Pass the entire buffer through an awk script\n" "Ctrl-V Ctrl-S -- Pass the entire buffer through a sed script\n" "Ctrl-V Ctrl-B -- Pass several lines of the buffer through a shell command\n" "Ctrl-V Ctrl-D -- Pass several lines of the buffer through an awk script\n" "Ctrl-V Ctrl-F -- Pass several lines of the buffer through a sed script\n" "\n" "Ctrl-D Ctrl-D -- Perform an internal debug command\n" "Ctrl-D Ctrl-S -- Execute a SLang command\n" "\n" "Ctrl-X -- Write ALL buffers to disk and exit\n" " -- Exit without writing to disk\n" "Ctrl-Z -- Suspend the editor and escape to a prompt\n" "Ctrl-L -- Erase and redraw the entire screen\n" "\n" "Notes:\n" "1. means your default terminal interrupt key, which is normally\n" " set to Ctrl-C.\n" "\n" "2. Ctrl-Z is used to abort and suspend the editor. This is completely\n" " independent of the suspend key defined for your terminal. Sorry about this,\n" " but it appears to be a limitation of the screen management library (S-Lang)\n" " that I use, which provides no option to preserve the suspend key, so I have\n" " to emulate it with kill(0, SIGSTOP).\n"); buf->text = read_string (help_text); buf->rdonly = 1; if (buf->text == NULL) { errno = ENOMEM; return -1; } buf->modified = 0; buf->scrollpos = buf->text; buf->scrollnum = 0; buf->scrollcol = 0; buf->pos.line = buf->text; buf->pos.col = 0; buf->scr_col = 0; buf->preferred_col = 0; buf->linenum = 0; buf->fname = NULL; buf->name = "?"; buf->mode_name = NULL; return 0; } buffer * get_helpbuf (void) { if (!help_initialized) init_helpbuf (); return &help_buf; } lpe-1.2.7/src/modes/0000755000175000017500000000000010327516141013117 5ustar adammadammlpe-1.2.7/src/modes/Makefile.in0000644000175000017500000004577010255442111015174 0ustar adammadamm# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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. @SET_MAKE@ SOURCES = $(cmode_la_SOURCES) $(cppmode_la_SOURCES) $(htmlmode_la_SOURCES) $(javamode_la_SOURCES) $(lispmode_la_SOURCES) $(mailmode_la_SOURCES) $(perlmode_la_SOURCES) $(sgmlmode_la_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/modes DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(liblpedir)" liblpeLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(liblpe_LTLIBRARIES) cmode_la_LIBADD = am_cmode_la_OBJECTS = cmode.lo cmode_la_OBJECTS = $(am_cmode_la_OBJECTS) cppmode_la_LIBADD = am_cppmode_la_OBJECTS = cppmode.lo cppmode_la_OBJECTS = $(am_cppmode_la_OBJECTS) htmlmode_la_LIBADD = am_htmlmode_la_OBJECTS = htmlmode.lo htmlmode_la_OBJECTS = $(am_htmlmode_la_OBJECTS) javamode_la_LIBADD = am_javamode_la_OBJECTS = javamode.lo javamode_la_OBJECTS = $(am_javamode_la_OBJECTS) lispmode_la_LIBADD = am_lispmode_la_OBJECTS = lispmode.lo lispmode_la_OBJECTS = $(am_lispmode_la_OBJECTS) mailmode_la_LIBADD = am_mailmode_la_OBJECTS = mailmode.lo mailmode_la_OBJECTS = $(am_mailmode_la_OBJECTS) perlmode_la_LIBADD = am_perlmode_la_OBJECTS = perlmode.lo perlmode_la_OBJECTS = $(am_perlmode_la_OBJECTS) sgmlmode_la_LIBADD = am_sgmlmode_la_OBJECTS = sgmlmode.lo sgmlmode_la_OBJECTS = $(am_sgmlmode_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(cmode_la_SOURCES) $(cppmode_la_SOURCES) \ $(htmlmode_la_SOURCES) $(javamode_la_SOURCES) \ $(lispmode_la_SOURCES) $(mailmode_la_SOURCES) \ $(perlmode_la_SOURCES) $(sgmlmode_la_SOURCES) DIST_SOURCES = $(cmode_la_SOURCES) $(cppmode_la_SOURCES) \ $(htmlmode_la_SOURCES) $(javamode_la_SOURCES) \ $(lispmode_la_SOURCES) $(mailmode_la_SOURCES) \ $(perlmode_la_SOURCES) $(sgmlmode_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DL_LIB = @DL_LIB@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GENCAT = @GENCAT@ GLIBC2 = @GLIBC2@ GLIBC21 = @GLIBC21@ GMSGFMT = @GMSGFMT@ HAVE_ASPRINTF = @HAVE_ASPRINTF@ HAVE_POSIX_PRINTF = @HAVE_POSIX_PRINTF@ HAVE_SNPRINTF = @HAVE_SNPRINTF@ HAVE_WPRINTF = @HAVE_WPRINTF@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLBISON = @INTLBISON@ INTLLIBS = @INTLLIBS@ INTLOBJS = @INTLOBJS@ INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MKINSTALLDIRS = @MKINSTALLDIRS@ MODES = @MODES@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ POSUB = @POSUB@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SLANG_LIB = @SLANG_LIB@ STRIP = @STRIP@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_INCLUDED_LIBINTL_FALSE = @USE_INCLUDED_LIBINTL_FALSE@ USE_INCLUDED_LIBINTL_TRUE = @USE_INCLUDED_LIBINTL_TRUE@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ lpe_DEPS = @lpe_DEPS@ lpe_LDFLAGS = @lpe_LDFLAGS@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ MAINTAINERCLEANFILES = Makefile.in INCLUDES = -I$(top_srcdir)/src liblpedir = $(libdir)/lpe liblpe_LTLIBRARIES = @MODES@ EXTRA_LTLIBRARIES = \ cmode.la cppmode.la perlmode.la htmlmode.la sgmlmode.la \ mailmode.la javamode.la lispmode.la cmode_la_SOURCES = cmode.c cmode_la_LDFLAGS = -no-undefined -avoid-version -module -export-dynamic -rpath $(liblpedir) cppmode_la_SOURCES = cppmode.c cppmode_la_LDFLAGS = -no-undefined -avoid-version -module -export-dynamic -rpath $(liblpedir) perlmode_la_SOURCES = perlmode.c perlmode_la_LDFLAGS = -no-undefined -avoid-version -module -export-dynamic -rpath $(liblpedir) htmlmode_la_SOURCES = htmlmode.c htmlmode_la_LDFLAGS = -no-undefined -avoid-version -module -export-dynamic -rpath $(liblpedir) sgmlmode_la_SOURCES = sgmlmode.c sgmlmode_la_LDFLAGS = -no-undefined -avoid-version -module -export-dynamic -rpath $(liblpedir) mailmode_la_SOURCES = mailmode.c mailmode_la_LDFLAGS = -no-undefined -avoid-version -module -export-dynamic -rpath $(liblpedir) javamode_la_SOURCES = javamode.c javamode_la_LDFLAGS = -no-undefined -avoid-version -module -export-dynamic -rpath $(liblpedir) lispmode_la_SOURCES = lispmode.c lispmode_la_LDFLAGS = -no-undefined -avoid-version -module -export-dynamic -rpath $(liblpedir) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/modes/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/modes/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-liblpeLTLIBRARIES: $(liblpe_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(liblpedir)" || $(mkdir_p) "$(DESTDIR)$(liblpedir)" @list='$(liblpe_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(liblpeLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(liblpedir)/$$f'"; \ $(LIBTOOL) --mode=install $(liblpeLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(liblpedir)/$$f"; \ else :; fi; \ done uninstall-liblpeLTLIBRARIES: @$(NORMAL_UNINSTALL) @set -x; list='$(liblpe_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(liblpedir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(liblpedir)/$$p"; \ done clean-liblpeLTLIBRARIES: -test -z "$(liblpe_LTLIBRARIES)" || rm -f $(liblpe_LTLIBRARIES) @list='$(liblpe_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done cmode.la: $(cmode_la_OBJECTS) $(cmode_la_DEPENDENCIES) $(LINK) $(cmode_la_LDFLAGS) $(cmode_la_OBJECTS) $(cmode_la_LIBADD) $(LIBS) cppmode.la: $(cppmode_la_OBJECTS) $(cppmode_la_DEPENDENCIES) $(LINK) $(cppmode_la_LDFLAGS) $(cppmode_la_OBJECTS) $(cppmode_la_LIBADD) $(LIBS) htmlmode.la: $(htmlmode_la_OBJECTS) $(htmlmode_la_DEPENDENCIES) $(LINK) $(htmlmode_la_LDFLAGS) $(htmlmode_la_OBJECTS) $(htmlmode_la_LIBADD) $(LIBS) javamode.la: $(javamode_la_OBJECTS) $(javamode_la_DEPENDENCIES) $(LINK) $(javamode_la_LDFLAGS) $(javamode_la_OBJECTS) $(javamode_la_LIBADD) $(LIBS) lispmode.la: $(lispmode_la_OBJECTS) $(lispmode_la_DEPENDENCIES) $(LINK) $(lispmode_la_LDFLAGS) $(lispmode_la_OBJECTS) $(lispmode_la_LIBADD) $(LIBS) mailmode.la: $(mailmode_la_OBJECTS) $(mailmode_la_DEPENDENCIES) $(LINK) $(mailmode_la_LDFLAGS) $(mailmode_la_OBJECTS) $(mailmode_la_LIBADD) $(LIBS) perlmode.la: $(perlmode_la_OBJECTS) $(perlmode_la_DEPENDENCIES) $(LINK) $(perlmode_la_LDFLAGS) $(perlmode_la_OBJECTS) $(perlmode_la_LIBADD) $(LIBS) sgmlmode.la: $(sgmlmode_la_OBJECTS) $(sgmlmode_la_DEPENDENCIES) $(LINK) $(sgmlmode_la_LDFLAGS) $(sgmlmode_la_OBJECTS) $(sgmlmode_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cppmode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htmlmode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/javamode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lispmode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mailmode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perlmode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sgmlmode.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(liblpedir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-liblpeLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-liblpeLTLIBRARIES install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am uninstall-liblpeLTLIBRARIES .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-liblpeLTLIBRARIES clean-libtool ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am \ install-liblpeLTLIBRARIES install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-info-am \ uninstall-liblpeLTLIBRARIES # 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: lpe-1.2.7/src/modes/perlmode.c0000644000175000017500000003734507136076620015115 0ustar adammadamm/* perlmode.c * * Copyright (c) 1999 Chris Smith * * Author: * Eckehard Berns * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ /* Known bugs: * * The syntax highlighting doesn't do "if /foo/" or "if foo =~ /bar/" regular * expression highlighting. I have no idea how to catch regexps without the * leading m without doing expensive syntax parsing. * * This forces me to remove the other regexp highlighting from perlmode also. * Because anything can happen in a "if /foo/" statement. I'll reenable it * when I found a way to highlight these regexps. */ #undef HIGHLIGHT_REGEXPS #include #include #include "lpecomm.h" #include "highlight.h" #include "mode-utils.h" /* If this is true nearly all keywords found in perlfunc(1p) get * highlighted. This is kind of overkill. */ #define EXTENDED_KEYWORDS 1 /* List of keywords. The ord value of the first character of the string at * index 0 must contain the maximum length of the keywords defined in the * list. All subsequent strings hold the list of keywords with the length * indicated by the array index. So keywords[1] holds all keywords with the * length of 1, keywords[2] all with the length of 2, and so on. NULL pointers * aren't allowed and will produce segfaults. */ static const char *keywords[] = { #if EXTENDED_KEYWORDS "\007", /* maximum length is 7 */ "", "dolcmynoucifneeqlegeltgtor", "chrhexoctordposabscosexpintlogoctsinpopmapdieeofvecsubreftie" "fornotand", "choppackrandsqrtpushgrepjoinsorteachkeysgetcreadseektellwarn" "globlinkopenstatdumpevalexitgotolastnextredoexecforkkillpipe" "waittiedbindrecvsendtimethenelse", "chompcryptindexsplitstudyatan2srandshiftcloseflockprintwrite" "chdirchmodchownfcntlioctllstatmkdirrmdirumaskutimelocalreset" "undefalarmsleeptimesblassuntiesemopelsifwhile", "lengthrindexsubstrspliceunpackdeleteexistsvaluesformatprintf" "selectchrootrenameunlinkcallerreturnimportscalarsystemaccept" "listensocketmsgctlmsggetmsgrcvmsgsndsemctlsemgetshmctlshmget" "gmtime", "lcfirstreversesprintfucfirstunshiftbinmodedbmopenreaddirseekdir" "syscallsysreadsysseektelldiropendirsymlinkgetpgrpgetppidsetpgrp" "connectshmreadforeach", #else /* !EXTENDED_KEYWORDS */ "\007", "", "ifneeqltgtlegedoor", "forsubdienotand", "nextlastelsewarn", "elsifwhile", "", "foreach", #endif /* !EXTENDED_KEYWORDS */ }; static const char *preproc[] = { "\007", "", "", "use", "", "", "import", "requirepackage", }; /* I need these to save the character used in qq// style strings between * calls to mode_highlight. The overall state is specified by the high byte. * The character needed to terminate this state is saved in the low byte as * an option to the state. */ #define STATE_MASK 0xff00 #define STATE_OPT_MASK 0x00ff #define STATE_BEGIN 0x0000 #define STATE_IN_SQUOTE 0x0100 #define STATE_IN_DQUOTE 0x0200 #define STATE_IN_SHELL 0x0300 #define STATE_IN_REGEXP 0x0400 #define STATE_LAST_REGEXP 0x0500 #define COLOR_VARIABLE 70 #define COLOR_SHELL 71 #ifdef HIGHLIGHT_REGEXPS #define COLOR_REGEXP 72 #endif /* defined(HIGHLIGHT_REGEXPS) */ int mode_accept(buffer *buf) { char *suffix; suffix = strrchr(buf->name, '.'); if ( ( suffix != NULL && mode_util_accept_extensions ( suffix, 0, 2, ".pl", ".pm" ) ) || mode_util_accept_on_request ( buf->text->txt, 0, 1, "perl" ) ) return 1; /* Check the first line of the file for the string "perl". * This isn't perfect, but should be a good guess. */ if (buf->text->txt[0] != '#') return 0; if (strstr(buf->text->txt, "perl") != NULL) return 1; return 0; } void mode_init(buffer *buf) { if (buf->mode_name == NULL) { buf->hardtab = mode_util_get_option_with_default ( "perlmode", "hardtab", 1 ); buf->autoindent = mode_util_get_option_with_default ( "perlmode", "autoindent", 1 ); buf->offerhelp = mode_util_get_option_with_default ( "perlmode", "offerhelp", 1 ); buf->highlight = mode_util_get_option_with_default ( "perlmode", "highlight", 1 ); buf->flashbrace = mode_util_get_option_with_default ( "perlmode", "flashbrace", 1 ); } buf->mode_name = "perlmode"; buf->state_valid = buf->text; buf->state_valid_num = 0; buf->text->start_state = STATE_BEGIN; } void mode_enter(buffer *buf) { mode_util_set_slang_color ( "cmode", "ident", COLOR_IDENT, COLOR_IDENT_FG, COLOR_IDENT_BG ); mode_util_set_slang_color ( "cmode", "symbol", COLOR_SYMBOL, COLOR_SYMBOL_FG, COLOR_SYMBOL_BG ); mode_util_set_slang_color ( "cmode", "brace", COLOR_BRACE, COLOR_BRACE_FG, COLOR_BRACE_BG ); mode_util_set_slang_color ( "cmode", "comment", COLOR_COMMENT, COLOR_COMMENT_FG, COLOR_COMMENT_BG ); mode_util_set_slang_color ( "cmode", "keyword", COLOR_KEYWORD, COLOR_KEYWORD_FG, COLOR_KEYWORD_BG ); mode_util_set_slang_color ( "cmode", "preproc", COLOR_PREPROC, COLOR_PREPROC_FG, COLOR_PREPROC_BG ); mode_util_set_slang_color ( "cmode", "string", COLOR_STRING, COLOR_STRING_FG, COLOR_STRING_BG ); mode_util_set_slang_color ( "cmode", "number", COLOR_NUMBER, COLOR_NUMBER_FG, COLOR_NUMBER_BG ); mode_util_set_slang_color ( "cmode", "stringe", COLOR_STRINGE, COLOR_STRINGE_FG, COLOR_STRINGE_BG ); mode_util_set_slang_color ( "cmode", "illegal", COLOR_ILLEGAL, COLOR_ILLEGAL_FG, COLOR_ILLEGAL_BG ); mode_util_set_slang_color ( "cmode", "debug", COLOR_DEBUG, COLOR_DEBUG_FG, COLOR_DEBUG_BG ); mode_util_set_slang_color ( "perlmode", "variable", COLOR_VARIABLE, "brightcyan", "black" ); mode_util_set_slang_color ( "perlmode", "shell", COLOR_SHELL, "magneta", "black" ); #ifdef HIGHLIGHT_REGEXPS mode_util_set_slang_color ( "perlmode", "regexp", COLOR_REGEXP, "magneta", "black" ); #endif /* HIGHLIGHT_REGEXPS */ } /* Perl implementation of brace flashing * * Rules: * 1. Braces are (), [], and {}, and they must be properly nested * 2. Ignore anything inside quotation marks (single or double) * 3. Disregard rule 2 if the quote is escaped * 4. Ignore anything after a hash (perl comment) * 5. Print a silent warning in the minibuf for known mismatched braces */ int mode_flashbrace(buffer * buf) { char brace_stack[1024]; int sp; char ch, quote; if (buf->pos.col == 0) return 0; ch = buf->pos.line->txt[buf->pos.col - 1]; if ((ch != ')') && (ch != ']') && (ch != '}')) return 0; if ((strchr(buf->pos.line->txt, '#')) && (buf->pos.col > strchr(buf->pos.line->txt, '#') - buf->pos.line->txt)) return 0; /* we're in a comment */ brace_stack[0] = ch; sp = 1; buf->pos.col--; quote = '\0'; do { char last_ch; while (buf->pos.col <= 0) { if (buf->pos.line == buf->scrollpos) return 0; buf->pos.line = buf->pos.line->prev; buf->linenum--; buf->pos.col = strlen(buf->pos.line->txt); if (strchr(buf->pos.line->txt, '#')) { buf->pos.col = strchr(buf->pos.line->txt, '#') - buf->pos.line->txt; } } buf->pos.col--; last_ch = ch; ch = buf->pos.line->txt[buf->pos.col]; if (quote != '\0') { if (ch == quote) quote = '\0'; else if ((last_ch == quote) && (ch == '\\')) quote = 0; continue; } switch (ch) { case ')': case ']': case '}': if (sp == 1024) return 0; brace_stack[sp++] = ch; break; case '(': if (brace_stack[--sp] != ')') { return -1; } break; case '[': if (brace_stack[--sp] != ']') { return -1; } break; case '{': if (brace_stack[--sp] != '}') { return -1; } break; case '\'': case '\"': quote = ch; break; case '\\': if ((last_ch == '\'') || (last_ch == '\"')) quote = last_ch; break; } } while (sp != 0); set_scr_col(buf); return 1; } /* These two macros check if a character can be part of a valid variable or * function name */ #define IS_VAR(a) (isalnum(a) || ((a) == '_')) #define IS_VAR1(a) (isalpha(a) || ((a) == '#')) /* This function checks if the word found at *idx within the line ln is in * the list of *words[]. If the word isn't found in the list, * 0 is returned. Otherwise the length of the found word is returned. * maxlen is used as input and output. If the contents of *maxlen is empty, * the length will be computed and stored in that variable. This should * prevent duplicate length calculation. */ static int check_words(buf_line * ln, int *idx, const char *words[], int *maxlen) { int i, len; const char *c, *p, *w; if (!IS_VAR1(ln->txt[*idx])) return 0; /* paranoia */ if ((maxlen) && (*maxlen)) len = *maxlen; else len = 0; if (len == 0) { for (len = 1; IS_VAR(ln->txt[*idx + len]); len++) ; if (maxlen) *maxlen = len; } if (len > words[0][0]) return 0; for (w = words[len]; *w; w += len) { p = &(ln->txt[*idx]); for (i = 0, c = w; i < len; i++, c++, p++) if (*c != *p) break; if (i == len) return len; } return 0; } /* The exported highlighting function. */ int mode_highlight(buffer * buf, buf_line * ln, int lnum, int *idx, int *state) { int color, ch, i; int tmp; if (*state == -1) { *state = buf->state_valid->start_state; while (buf->state_valid_num < lnum) { i = 0; while (buf->state_valid->txt[i]) mode_highlight(buf, buf->state_valid, buf->state_valid_num, &i, state); buf->state_valid = buf->state_valid->next; buf->state_valid_num++; buf->state_valid->start_state = *state; } i = 0; color = -1; *state = ln->start_state; while (i < *idx) color = mode_highlight(buf, ln, lnum, &i, state); if ((i > *idx) && (color != -1)) { *idx = i; return color; } } if (ln->txt[*idx] == 0) return COLOR_IDENT; /* single quotes */ if ((*state & STATE_MASK) == STATE_IN_SQUOTE) { while (ln->txt[*idx]) { if ((((*idx) && (ln->txt[*idx - 1] != '\\')) || (*idx == 0)) && (ln->txt[*idx] == (*state & STATE_OPT_MASK))) { *state = STATE_BEGIN; (*idx)++; return COLOR_STRING; } (*idx)++; } return COLOR_STRING; } /* variables */ if (strchr("$%@&", ln->txt[*idx])) { (*idx)++; if (ln->txt[*idx] == '{') { for ((*idx)++; (ln->txt[*idx]) && (ln->txt[*idx] != '}'); (*idx)++) ; if (ln->txt[*idx]) { (*idx)++; return COLOR_VARIABLE; } return COLOR_ILLEGAL; } if (ln->txt[*idx] == '#') (*idx)++; for (; (ln->txt[*idx]) && (IS_VAR(ln->txt[*idx])); (*idx)++) ; return COLOR_VARIABLE; } /* escaped characters */ if (ln->txt[*idx] == '\\') { (*idx)++; if (ln->txt[*idx] == 0) { return COLOR_SYMBOL; } if (ln->txt[*idx] == 'x') { for ((*idx)++, tmp = 0; (ln->txt[*idx]) && (tmp < 2) && (strchr("0123456789abcdefABCDEF", ln->txt[*idx])); (*idx)++, tmp++) ; if (tmp == 0) return COLOR_ILLEGAL; return COLOR_STRINGE; } if (strchr("01234567", ln->txt[*idx])) { for ((*idx)++, tmp = 0; (ln->txt[*idx]) && (strchr("01234567", ln->txt[*idx])); tmp++, (*idx)++) ; if (tmp > 2) return COLOR_ILLEGAL; return COLOR_STRINGE; } (*idx)++; return COLOR_STRINGE; } #ifdef HIGHLIGHT_REGEXPS /* regexps (first part of ///) */ if ((*state & STATE_MASK) == STATE_IN_REGEXP) { while ((ch = ln->txt[*idx]) != 0) { if ((((*idx) && (ln->txt[*idx - 1] != '\\')) || (*idx == 0)) && (ch == (*state & STATE_OPT_MASK))) { *state = (*state & STATE_OPT_MASK) | STATE_LAST_REGEXP; (*idx)++; break; } (*idx)++; } if ((*state & STATE_MASK) != STATE_LAST_REGEXP) return COLOR_REGEXP; } /* regexps (second part of /// or just //) */ if ((*state & STATE_MASK) == STATE_LAST_REGEXP) { while ((ch = ln->txt[*idx]) != 0) { if ((((*idx) && (ln->txt[*idx - 1] != '\\')) || (*idx == 0)) && (ch == (*state & STATE_OPT_MASK))) { *state = STATE_BEGIN; (*idx)++; return COLOR_REGEXP; } (*idx)++; } return COLOR_REGEXP; } #endif /* defined(HIGHLIGHT_REGEXPS) */ /* double quotes */ if ((*state & STATE_MASK) == STATE_IN_DQUOTE) { while ((ch = ln->txt[*idx]) != 0) { if ((((*idx) && (ln->txt[*idx - 1] != '\\')) || (*idx == 0)) && (ch == (*state & STATE_OPT_MASK))) { *state = STATE_BEGIN; (*idx)++; return COLOR_STRING; } if ((ch == '\\') || (ch == '$')) return COLOR_STRING; (*idx)++; } return COLOR_STRING; } /* `cmd` style shell commands */ if (*state == STATE_IN_SHELL) { while ((ch = ln->txt[*idx]) != 0) { if ((((*idx) && (ln->txt[*idx - 1] != '\\')) || (*idx == 0)) && (ch == '`')) { *state = STATE_BEGIN; (*idx)++; return COLOR_SHELL; } if ((ch == '\\') || (ch == '$')) return COLOR_SHELL; (*idx)++; } return COLOR_SHELL; } /* comments */ if (ln->txt[*idx] == '#') { *idx = strlen(ln->txt); return COLOR_COMMENT; } #ifdef HIGHLIGHT_REGEXPS /* start of regexps: m//, s///, tr///, etc */ if ((ln->txt[*idx + 1]) && (!IS_VAR(ln->txt[*idx + 1])) && (!strchr("([{", ln->txt[*idx + 1])) && (((*idx > 0) && (ln->txt[*idx - 1] != '/')) || (*idx == 0))) { if (ln->txt[*idx] == 'm') *state = STATE_LAST_REGEXP | (ln->txt[*idx + 1] & STATE_OPT_MASK); else if (ln->txt[*idx] == 's') *state = STATE_IN_REGEXP | (ln->txt[*idx + 1] & STATE_OPT_MASK); if (*state != STATE_BEGIN) { (*idx) += 2; return COLOR_REGEXP; } } if ((IS_VAR(ln->txt[*idx + 1])) && (!strchr("([{", ln->txt[*idx + 2])) && (ln->txt[*idx + 2]) && (!IS_VAR(ln->txt[*idx + 2]))) { if ((ln->txt[*idx] == 't') && (ln->txt[*idx + 1] == 'r')) *state = STATE_IN_REGEXP | (ln->txt[*idx + 2] & STATE_OPT_MASK); if (*state != STATE_BEGIN) { (*idx) += 3; return COLOR_REGEXP; } } #endif /* defined(HIGHLIGHT_REGEXPS) */ /* start of qq// and q// */ if (ln->txt[*idx] == 'q') { if ((ln->txt[*idx + 1]) && (!IS_VAR(ln->txt[*idx + 1]))) { if (ln->txt[*idx + 1] == '(') *state = STATE_IN_SQUOTE | ')'; else if (ln->txt[*idx + 1] == '[') *state = STATE_IN_SQUOTE | ']'; else if (ln->txt[*idx + 1] == '{') *state = STATE_IN_SQUOTE | '}'; else *state = STATE_IN_SQUOTE | (ln->txt[*idx + 1] & STATE_OPT_MASK); (*idx) += 2; return COLOR_STRING; } if ((ln->txt[*idx + 1]) && (ln->txt[*idx + 2]) && (ln->txt[*idx + 1] == 'q') && (!IS_VAR(ln->txt[*idx + 2]))) { if (ln->txt[*idx + 2] == '(') *state = STATE_IN_DQUOTE | ')'; else if (ln->txt[*idx + 2] == '[') *state = STATE_IN_DQUOTE | ']'; else if (ln->txt[*idx + 2] == '{') *state = STATE_IN_DQUOTE | '}'; else *state = STATE_IN_DQUOTE | (ln->txt[*idx + 2] & STATE_OPT_MASK); (*idx) += 3; return COLOR_STRING; } } /* keywords etc. */ if (IS_VAR1(ln->txt[*idx])) { i = 0; if (check_words(ln, idx, keywords, &i)) { (*idx) += i; return COLOR_KEYWORD; } if (check_words(ln, idx, preproc, &i)) { (*idx) += i; return COLOR_PREPROC; } (*idx) += i; return COLOR_IDENT; } /* the rest */ if (ln->txt[*idx] == '\'') { *state = STATE_IN_SQUOTE | '\''; color = COLOR_STRING; } else if (ln->txt[*idx] == '"') { *state = STATE_IN_DQUOTE | '"'; color = COLOR_STRING; } else if (ln->txt[*idx] == '`') { *state = STATE_IN_SHELL; color = COLOR_SHELL; } else if (strchr("-+,.?=~!&/;*<>|", ln->txt[*idx])) color = COLOR_SYMBOL; else if ((ln->txt[*idx] >= '0') && (ln->txt[*idx] <= '9')) color = COLOR_NUMBER; else if (strchr(" \n\v\t\r", ln->txt[*idx])) color = COLOR_IDENT; else if (strchr("()[]{}", ln->txt[*idx])) color = COLOR_BRACE; else color = COLOR_IDENT; (*idx)++; return color; } lpe-1.2.7/src/modes/javamode.c0000644000175000017500000011302407136076600015057 0ustar adammadamm/* javamode.c * * Copyright (c) 1999 Chris Smith * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #include #include #include "lpecomm.h" #include "highlight.h" #include "mode-utils.h" int mode_accept(buffer *buf) { char *suffix; suffix = strrchr(buf->name, '.'); if (suffix == NULL) return 0; return mode_util_accept_extensions ( suffix, 0, 1, ".java" ) || mode_util_accept_on_request ( buf->text->txt, 0, 1, "java" ); } void mode_init(buffer *buf) { if (buf->mode_name == NULL) { buf->hardtab = mode_util_get_option_with_default ( "javamode", "hardtab", 1 ); buf->autoindent = mode_util_get_option_with_default ( "javamode", "autoindent", 1 ); buf->offerhelp = mode_util_get_option_with_default ( "javamode", "offerhelp", 1 ); buf->highlight = mode_util_get_option_with_default ( "javamode", "highlight", 1 ); buf->flashbrace = mode_util_get_option_with_default ( "javamode", "flashbrace", 1 ); } buf->mode_name = "javamode"; buf->state_valid = buf->text; buf->state_valid_num = 0; buf->text->start_state = 0; } void mode_enter(buffer *buf) { mode_util_set_slang_color ( "javamode", "ident", COLOR_IDENT, COLOR_IDENT_FG, COLOR_IDENT_BG ); mode_util_set_slang_color ( "javamode", "symbol", COLOR_SYMBOL, COLOR_SYMBOL_FG, COLOR_SYMBOL_BG ); mode_util_set_slang_color ( "javamode", "brace", COLOR_BRACE, COLOR_BRACE_FG, COLOR_BRACE_BG ); mode_util_set_slang_color ( "javamode", "comment", COLOR_COMMENT, COLOR_COMMENT_FG, COLOR_COMMENT_BG ); mode_util_set_slang_color ( "javamode", "keyword", COLOR_KEYWORD, COLOR_KEYWORD_FG, COLOR_KEYWORD_BG ); mode_util_set_slang_color ( "javamode", "preproc", COLOR_PREPROC, COLOR_PREPROC_FG, COLOR_PREPROC_BG ); mode_util_set_slang_color ( "javamode", "string", COLOR_STRING, COLOR_STRING_FG, COLOR_STRING_BG ); mode_util_set_slang_color ( "javamode", "number", COLOR_NUMBER, COLOR_NUMBER_FG, COLOR_NUMBER_BG ); mode_util_set_slang_color ( "javamode", "stringe", COLOR_STRINGE, COLOR_STRINGE_FG, COLOR_STRINGE_BG ); mode_util_set_slang_color ( "javamode", "illegal", COLOR_ILLEGAL, COLOR_ILLEGAL_FG, COLOR_ILLEGAL_BG ); mode_util_set_slang_color ( "javamode", "debug", COLOR_DEBUG, COLOR_DEBUG_FG, COLOR_DEBUG_BG ); } /* Java implementation of brace flashing * * Rules: * 1. Braces are (), [], and {}, and they must be properly nested * 2. Ignore anything inside quotation marks (single or double) * 3. Disregard rule 2 if the quote is escaped * 4. Ignore anything in a C-style comment (slash-star) * 5. If currently in a comment, don't match with anything outside of it * 6. Print a silent warning in the minibuf for known mismatched braces */ int mode_flashbrace(buffer *buf) { int is_comment; char brace_stack[1024]; int sp; char ch, quote; if (buf->pos.col == 0) return 0; ch = buf->pos.line->txt[buf->pos.col - 1]; if ((ch != ')') && (ch != ']') && (ch != '}')) return 0; brace_stack[0] = ch; sp = 1; buf->pos.col--; quote = '\0'; is_comment = 0; do { char last_ch; while (buf->pos.col <= 0) { if (buf->pos.line == buf->scrollpos) return 0; buf->pos.line = buf->pos.line->prev; buf->linenum--; buf->pos.col = strlen(buf->pos.line->txt); } buf->pos.col--; last_ch = ch; ch = buf->pos.line->txt[buf->pos.col]; if (is_comment) { if ((ch == '/') && (last_ch == '*')) is_comment = 0; continue; } if (quote != '\0') { if ((ch == '*') && (last_ch == '/')) { is_comment = 1; ch = '\0'; /* must find another '*' to close comment */ } else if (ch == quote) quote = '\0'; else if ((last_ch == quote) && (ch == '\\')) quote = 0; continue; } switch (ch) { case ')': case ']': case '}': if (sp == 1024) return 0; brace_stack[sp++] = ch; break; case '(': if (brace_stack[--sp] != ')') { return -1; } break; case '[': if (brace_stack[--sp] != ']') { return -1; } break; case '{': if (brace_stack[--sp] != '}') { return -1; } break; case '\'': case '\"': quote = ch; break; case '\\': if ((last_ch == '\'') || (last_ch == '\"')) quote = last_ch; break; case '*': if (last_ch == '/') { is_comment = 1; ch = '\0'; /* must find another '*' to close comment */ } break; case '/': if (last_ch == '*') return 0; /* we were in a comment */ break; } } while (sp != 0); set_scr_col(buf); return 1; } enum _states { STATE_BEGIN = 0, STATE_WHITESPACE, STATE_WORD, STATE_SLASH, STATE_COMMENT, STATE_COMMENT_STAR, STATE_COMMENT_DONE, STATE_LINE_COMMENT, STATE_STRING_CONST, STATE_STRING_CONST_ESC, STATE_STRING_CONST_ESCOCT_1, STATE_STRING_CONST_ESCOCT_2, STATE_CHAR_CONST, STATE_CHAR_CONST_ESC, STATE_CHAR_CONST_ESCOCT_1, STATE_CHAR_CONST_ESCOCT_2, STATE_0, STATE_NUM_WHOLE, STATE_NUM_HEX, STATE_NUM_LEAD0_OCT, STATE_NUM_LEAD0, STATE_NUM_SUFF, STATE_DOT, STATE_NUM_FRACT, STATE_FRACT_SUFF_E, STATE_FRACT_E_SIGN, STATE_FRACT_E_VAL, STATE_FRACT_SUFF, STATE_PANIC }; /* This deserves a little explanation to say the least. This table is used to * compare identifiers against valid keywords and decide whether to color them * as keywords. Keywords are spelled out in columns of the array, and must be * in alphabetical order (by ASCII code -- so capital letters first. The * number, w, is the number of entries in the table, including this one, that * begin with the same sequence of letters. * * For example, since there are four C keywords that begin with the letter 'c', * kwtbl[0][2].w == 4. There are two keywords beginning 'con', and so * kwtbl[2][4].w == 2. */ #define N_KEYWORDS 59 typedef struct { unsigned char ch; unsigned char w; } kwtbl_ent; kwtbl_ent kwtbl[][N_KEYWORDS] = { { {'a',1}, {'b',4}, {'b',3}, {'b',2}, {'b',1}, {'c',7}, {'c',6}, {'c',5}, {'c',4}, {'c',3}, {'c',2}, {'c',1}, {'d',3}, {'d',2}, {'d',1}, {'e',2}, {'e',1}, {'f',6}, {'f',5}, {'f',4}, {'f',3}, {'f',2}, {'f',1}, {'g',2}, {'g',1}, {'i',7}, {'i',6}, {'i',5}, {'i',4}, {'i',3}, {'i',2}, {'i',1}, {'l',1}, {'n',3}, {'n',2}, {'n',1}, {'o',2}, {'o',1}, {'p',4}, {'p',3}, {'p',2}, {'p',1}, {'r',2}, {'r',1}, {'s',5}, {'s',4}, {'s',3}, {'s',2}, {'s',1}, {'t',6}, {'t',5}, {'t',4}, {'t',3}, {'t',2}, {'t',1}, {'v',3}, {'v',2}, {'v',1}, {'w',1} }, { {'b',1}, {'o',1}, {'r',1}, {'y',2}, {'y',1}, {'a',3}, {'a',2}, {'a',1}, {'h',1}, {'l',1}, {'o',2}, {'o',1}, {'e',1}, {'o',2}, {'o',1}, {'l',1}, {'x',1}, {'a',1}, {'i',2}, {'i',1}, {'l',1}, {'o',1}, {'u',1}, {'e',1}, {'o',1}, {'f',1}, {'m',2}, {'m',1}, {'n',4}, {'n',3}, {'n',2}, {'n',1}, {'o',1}, {'a',1}, {'e',1}, {'u',1}, {'p',1}, {'u',1}, {'a',1}, {'r',2}, {'r',1}, {'u',1}, {'e',2}, {'e',1}, {'h',1}, {'t',1}, {'u',1}, {'w',1}, {'y',1}, {'h',3}, {'h',2}, {'h',1}, {'r',3}, {'r',2}, {'r',1}, {'a',1}, {'o',2}, {'o',1}, {'h',1} }, { {'s',1}, {'o',1}, {'e',1}, {'t',1}, {'v',1}, {'s',2}, {'s',1}, {'t',1}, {'a',1}, {'a',1}, {'n',2}, {'n',1}, {'f',1}, {' ',0}, {'u',1}, {'s',1}, {'t',1}, {'l',1}, {'n',2}, {'n',1}, {'o',1}, {'r',1}, {'t',1}, {'n',1}, {'t',1}, {' ',0}, {'p',2}, {'p',1}, {'n',1}, {'s',1}, {'t',2}, {'t',1}, {'n',1}, {'t',1}, {'w',1}, {'l',1}, {'e',1}, {'t',1}, {'c',1}, {'i',1}, {'o',1}, {'b',1}, {'s',1}, {'t',1}, {'o',1}, {'a',1}, {'p',1}, {'i',1}, {'n',1}, {'i',1}, {'r',2}, {'r',1}, {'a',1}, {'u',1}, {'y',1}, {'r',1}, {'i',1}, {'l',1}, {'i',1} }, { {'t',1}, {'l',1}, {'a',1}, {'e',1}, {'a',1}, {'e',1}, {'t',1}, {'c',1}, {'r',1}, {'s',1}, {'s',1}, {'t',1}, {'a',1}, {' ',0}, {'b',1}, {'e',1}, {'e',1}, {'s',1}, {'a',2}, {'a',1}, {'a',1}, {' ',0}, {'u',1}, {'e',1}, {'o',1}, {' ',0}, {'l',1}, {'o',1}, {'e',1}, {'t',1}, {' ',0}, {'e',1}, {'g',1}, {'i',1}, {' ',0}, {'l',1}, {'r',1}, {'e',1}, {'k',1}, {'v',1}, {'t',1}, {'l',1}, {'t',1}, {'u',1}, {'r',1}, {'t',1}, {'e',1}, {'t',1}, {'c',1}, {'s',1}, {'o',2}, {'o',1}, {'n',1}, {'e',1}, {' ',0}, {' ',0}, {'d',1}, {'a',1}, {'l',1} }, { {'r',1}, {'e',1}, {'k',1}, {' ',0}, {'l',1}, {' ',0}, {' ',0}, {'h',1}, {' ',0}, {'s',1}, {'t',1}, {'i',1}, {'u',1}, {' ',0}, {'l',1}, {' ',0}, {'n',1}, {'e',1}, {'l',2}, {'l',1}, {'t',1}, {' ',0}, {'r',1}, {'r',1}, {' ',0}, {' ',0}, {'e',1}, {'r',1}, {'r',1}, {'a',1}, {' ',0}, {'r',1}, {' ',0}, {'v',1}, {' ',0}, {' ',0}, {'a',1}, {'r',1}, {'a',1}, {'a',1}, {'e',1}, {'i',1}, {' ',0}, {'r',1}, {'t',1}, {'i',1}, {'r',1}, {'c',1}, {'h',1}, {' ',0}, {'w',2}, {'w',1}, {'s',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'t',1}, {'e',1} }, { {'a',1}, {'a',1}, {' ',0}, {' ',0}, {'u',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'n',1}, {'l',1}, {' ',0}, {'e',1}, {' ',0}, {'d',1}, {' ',0}, {' ',0}, {'l',1}, {' ',0}, {' ',0}, {'e',1}, {'i',1}, {' ',0}, {' ',0}, {'m',1}, {'t',1}, {' ',0}, {'n',1}, {' ',0}, {'f',1}, {' ',0}, {'e',1}, {' ',0}, {' ',0}, {'t',1}, {' ',0}, {'g',1}, {'t',1}, {'c',1}, {'c',1}, {' ',0}, {'n',1}, {' ',0}, {'c',1}, {' ',0}, {'h',1}, {'r',1}, {' ',0}, {' ',0}, {'s',1}, {'i',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'i',1}, {' ',0} }, { {'c',1}, {'n',1}, {' ',0}, {' ',0}, {'e',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'u',1}, {'t',1}, {' ',0}, {' ',0}, {' ',0}, {'s',1}, {' ',0}, {' ',0}, {'y',1}, {' ',0}, {' ',0}, {' ',0}, {'c',1}, {' ',0}, {' ',0}, {'e',1}, {' ',0}, {' ',0}, {'c',1}, {' ',0}, {'a',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'o',1}, {' ',0}, {'e',1}, {'e',1}, {'t',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'o',1}, {' ',0}, {' ',0}, {' ',0}, {'e',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'l',1}, {' ',0} }, { {'t',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'e',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'n',1}, {' ',0}, {' ',0}, {'e',1}, {' ',0}, {'c',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'r',1}, {' ',0}, {' ',0}, {' ',0}, {'e',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'n',1}, {' ',0}, {' ',0}, {' ',0}, {'n',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'e',1}, {' ',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}, {'t',1}, {' ',0}, {' ',0}, {'o',1}, {' ',0}, {'e',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'d',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'i',1}, {' ',0}, {' ',0}, {' ',0}, {'t',1}, {' ',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}, {'s',1}, {' ',0}, {' ',0}, {'f',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'z',1}, {' ',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}, {'e',1}, {' ',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}, {'d',1}, {' ',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}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0} } }; /* Modifies the values of kwpos and kwend with respect to the next character of * an identifier. kwpos points to the current position in the keyword table; * kwend to the first invalid position; n is the number of characters already * processed; and ch is the next character to process. The function will * update *kwpos and *kwend to take into account the new character. It will * set *kwpos to -1 if it determines that the word is not a keyword. */ static void check_kw(int *kwpos, int *kwend, int n, char ch) { int i; if (*kwpos == -1) return; while ((kwtbl[n][*kwpos].w == 0) && (*kwpos < *kwend)) (*kwpos)++; for (i = *kwpos; i < *kwend; i += kwtbl[n][i].w) if (ch == kwtbl[n][i].ch) break; if (i < *kwend) { *kwpos = i; *kwend = i + kwtbl[n][i].w; } else *kwpos = -1; } /* Utility function that does most of the work of the highlighter. It scans * the text using something resembling a DFA-based lexical scanner, except that * keywords are read from the table described above. The text to scan is * passed in txt, and pointers to variables containing a starting position and * starting state in idx and state. On return, idx and state are updated to * reflaect the next place to start scanning, and the return value is the * palette index to use when drawing the text. */ static int get_color(char *txt, int *idx, int *state) { int start_idx; int kwpos, kwend; kwpos = 0; kwend = N_KEYWORDS; start_idx = *idx; while (1) /* loop until we return a color */ { switch (*state) { case STATE_BEGIN: if (isspace(txt[*idx])) { *state = STATE_WHITESPACE; (*idx)++; } else if (isalpha(txt[*idx]) || (txt[*idx] == '_')) { check_kw(&kwpos, &kwend, 0, txt[*idx]); *state = STATE_WORD; (*idx)++; } else switch (txt[*idx]) { case '0': *state = STATE_0; (*idx)++; break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': *state = STATE_NUM_WHOLE; (*idx)++; break; case '.': *state = STATE_DOT; (*idx)++; break; case '/': *state = STATE_SLASH; (*idx)++; break; case '\"': *state = STATE_STRING_CONST; (*idx)++; break; case '\'': *state = STATE_CHAR_CONST; (*idx)++; break; case '\0': return COLOR_IDENT; case '(': case '[': case '{': case '}': case ']': case ')': (*idx)++; return COLOR_BRACE; default: (*idx)++; return COLOR_SYMBOL; } break; case STATE_WHITESPACE: while (isspace(txt[*idx])) (*idx)++; *state = STATE_BEGIN; return COLOR_IDENT; case STATE_WORD: while (isalnum(txt[*idx]) || (txt[*idx] == '_')) { check_kw(&kwpos, &kwend, (*idx) - start_idx, txt[*idx]); (*idx)++; } *state = STATE_BEGIN; if ((kwpos != -1) && (kwtbl[*idx - start_idx][kwpos].w == 0)) return COLOR_KEYWORD; else return COLOR_IDENT; case STATE_SLASH: switch (txt[*idx]) { case '*': *state = STATE_COMMENT; (*idx)++; break; case '/': *state = STATE_LINE_COMMENT; (*idx)++; break; default: *state = STATE_BEGIN; return COLOR_SYMBOL; } break; case STATE_COMMENT: while ((txt[*idx] != '*') && (txt[*idx] != '\0')) (*idx)++; if (txt[*idx] == '\0') return COLOR_COMMENT; *state = STATE_COMMENT_STAR; (*idx)++; break; case STATE_COMMENT_STAR: switch (txt[*idx]) { case '/': *state = STATE_COMMENT_DONE; (*idx)++; break; case '*': (*idx)++; break; case '\0': *state = STATE_COMMENT; return COLOR_COMMENT; default: *state = STATE_COMMENT; (*idx)++; } break; case STATE_COMMENT_DONE: *state = STATE_BEGIN; return COLOR_COMMENT; case STATE_LINE_COMMENT: while (txt[*idx] != '\0') (*idx)++; *state = STATE_BEGIN; return COLOR_COMMENT; case STATE_STRING_CONST: switch (txt[*idx]) { case '\"': (*idx)++; *state = STATE_BEGIN; return COLOR_STRING; case '\\': *state = STATE_STRING_CONST_ESC; return COLOR_STRING; case '\0': return COLOR_STRING; default: (*idx)++; } break; case STATE_STRING_CONST_ESC: (*idx)++; switch (txt[*idx]) { case '\0': *state = STATE_STRING_CONST; return COLOR_STRINGE; case '0': case '1': case '2': case '3': *state = STATE_STRING_CONST_ESCOCT_1; (*idx)++; break; case '4': case '5': case '6': case '7': *state = STATE_STRING_CONST_ESCOCT_2; (*idx)++; break; case 'b': case 't': case 'n': case 'f': case 'r': case '\\': case '\'': case '\"': *state = STATE_STRING_CONST; (*idx)++; return COLOR_STRINGE; default: *state = STATE_STRING_CONST; (*idx)++; return COLOR_ILLEGAL; } break; case STATE_STRING_CONST_ESCOCT_1: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_STRING_CONST_ESCOCT_2; (*idx)++; break; default: *state = STATE_STRING_CONST; return COLOR_STRINGE; } break; case STATE_STRING_CONST_ESCOCT_2: if ((txt[*idx] >= '0') && (txt[*idx] <= '7')) (*idx)++; *state = STATE_STRING_CONST; return COLOR_STRINGE; case STATE_CHAR_CONST: switch (txt[*idx]) { case '\'': (*idx)++; *state = STATE_BEGIN; return COLOR_STRING; case '\\': *state = STATE_CHAR_CONST_ESC; return COLOR_STRING; case '\0': *state = STATE_BEGIN; return COLOR_STRING; default: (*idx)++; } break; case STATE_CHAR_CONST_ESC: (*idx)++; switch (txt[*idx]) { case '\0': *state = STATE_CHAR_CONST; return COLOR_STRINGE; case '0': case '1': case '2': case '3': *state = STATE_CHAR_CONST_ESCOCT_1; (*idx)++; break; case '4': case '5': case '6': case '7': *state = STATE_CHAR_CONST_ESCOCT_2; (*idx)++; break; case 'b': case 't': case 'n': case 'f': case 'r': case '\\': case '\'': case '\"': *state = STATE_CHAR_CONST; (*idx)++; return COLOR_STRINGE; default: *state = STATE_CHAR_CONST; (*idx)++; return COLOR_ILLEGAL; } break; case STATE_CHAR_CONST_ESCOCT_1: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_CHAR_CONST_ESCOCT_2; (*idx)++; break; default: *state = STATE_CHAR_CONST; return COLOR_STRINGE; } break; case STATE_CHAR_CONST_ESCOCT_2: if ((txt[*idx] >= '0') && (txt[*idx] <= '7')) (*idx)++; *state = STATE_CHAR_CONST; return COLOR_STRINGE; case STATE_0: switch (txt[*idx]) { case 'x': case 'X': *state = STATE_NUM_HEX; (*idx)++; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_NUM_LEAD0_OCT; (*idx)++; break; case '8': case '9': *state = STATE_NUM_LEAD0; (*idx)++; break; case '.': *state = STATE_NUM_FRACT; (*idx)++; break; case 'L': case 'l': *state = STATE_NUM_SUFF; (*idx)++; break; default: if (isalpha(txt[*idx]) || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN; return COLOR_NUMBER; } } break; case STATE_NUM_HEX: if (isxdigit(txt[*idx])) { (*idx)++; } else switch (txt[*idx]) { case 'L': case 'l': *state = STATE_NUM_SUFF; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalpha(txt[*idx]) || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN; return COLOR_NUMBER; } } break; case STATE_NUM_WHOLE: while (isdigit(txt[*idx])) (*idx)++; switch (txt[*idx]) { case '.': *state = STATE_NUM_FRACT; (*idx)++; break; case 'L': case 'l': *state = STATE_NUM_SUFF; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalpha(txt[*idx]) || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN; return COLOR_NUMBER; } } break; case STATE_DOT: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': *state = STATE_NUM_FRACT; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_SYMBOL; default: *state = STATE_BEGIN; return COLOR_SYMBOL; } break; case STATE_NUM_LEAD0_OCT: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': (*idx)++; break; case '8': case '9': *state = STATE_NUM_LEAD0; (*idx)++; break; case '.': *state = STATE_NUM_FRACT; (*idx)++; break; case 'L': case 'l': *state = STATE_NUM_SUFF; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalpha(txt[*idx]) || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN; return COLOR_NUMBER; } } break; case STATE_NUM_LEAD0: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': (*idx)++; break; case '.': *state = STATE_NUM_FRACT; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_ILLEGAL; default: *state = STATE_PANIC; } break; case STATE_NUM_FRACT: while (isdigit(txt[*idx])) (*idx)++; switch (txt[*idx]) { case 'E': case 'e': *state = STATE_FRACT_SUFF_E; (*idx)++; break; case 'F': case 'f': case 'D': case 'd': *state = STATE_FRACT_SUFF; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalpha(txt[*idx]) || (txt[*idx] == '_') || (txt[*idx] == '.')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN; return COLOR_NUMBER; } } break; case STATE_NUM_SUFF: switch (txt[*idx]) { case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalnum(txt[*idx]) || (txt[*idx] == '.') || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN; return COLOR_NUMBER; } } break; case STATE_FRACT_SUFF_E: if (isdigit(txt[*idx])) { *state = STATE_FRACT_E_VAL; (*idx)++; } else if (isalpha(txt[*idx]) || (txt[*idx] == '.') || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else switch (txt[*idx]) { case '+': case '-': *state = STATE_FRACT_E_SIGN; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_ILLEGAL; default: *state = STATE_BEGIN; return COLOR_ILLEGAL; } break; case STATE_FRACT_E_SIGN: if (isdigit(txt[*idx])) { *state = STATE_FRACT_E_VAL; (*idx)++; } else if (isalpha(txt[*idx]) || (txt[*idx] == '.') || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else switch (txt[*idx]) { case '\0': *state = STATE_BEGIN; return COLOR_ILLEGAL; default: *state = STATE_BEGIN; return COLOR_ILLEGAL; } break; case STATE_FRACT_E_VAL: while (isdigit(txt[*idx])) (*idx)++; switch (txt[*idx]) { case 'F': case 'f': case 'D': case 'd': *state = STATE_FRACT_SUFF; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalpha(txt[*idx]) || (txt[*idx] == '.') || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN; return COLOR_NUMBER; } } break; case STATE_FRACT_SUFF: if (isalnum(txt[*idx]) || (txt[*idx] == '.') || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN; return COLOR_NUMBER; } break; case STATE_PANIC: while (isalnum(txt[*idx]) || (txt[*idx] == '_')) (*idx)++; *state = STATE_BEGIN; return COLOR_ILLEGAL; default: while (txt[*idx] != '\0') (*idx)++; return COLOR_DEBUG; } } return COLOR_IDENT; } /* The exported syntax highlighter function. This function itself really only * exists to take care of a few loose ends. In fact, these loose ends are * common to all languages, so this code should probably be moved to screen.c * instead of put here. But that's not possible now because the perl and SGML * modules act differently. As soon as I get all this stuff working the same, * I'll move stuff around to avoid duplicating code. */ int mode_highlight(buffer *buf, buf_line *ln, int lnum, int *idx, int *state) { if (*state == -1) { int i, pos; char *c; while (buf->state_valid_num < lnum) { c = buf->state_valid->txt; pos = 0; *state = buf->state_valid->start_state; do get_color(c, &pos, state); while (c[pos] != '\0'); buf->state_valid = buf->state_valid->next; buf->state_valid_num++; buf->state_valid->start_state = *state; } c = ln->txt; i = 0; *state = ln->start_state; while (i < *idx) get_color(c, &i, state); } return get_color(ln->txt, idx, state); } lpe-1.2.7/src/modes/cppmode.c0000644000175000017500000020121707136076542014727 0ustar adammadamm/* cppmode.c * * Copyright (c) 1999 Chris Smith * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #include #include #include "lpecomm.h" #include "highlight.h" #include "mode-utils.h" int mode_accept(buffer *buf) { char *suffix; suffix = strrchr(buf->name, '.'); if (suffix == NULL) return 0; return mode_util_accept_extensions ( suffix, 0, 8, ".cpp", ".hpp", ".cxx", ".hxx", ".cc", ".hh", ".c++", ".h++" ) || mode_util_accept_on_request ( buf->text->txt, 0, 2, "c++", "c++-source" ); } void mode_init(buffer *buf) { if (buf->mode_name == NULL) { buf->hardtab = mode_util_get_option_with_default ( "cppmode", "hardtab", 1 ); buf->autoindent = mode_util_get_option_with_default ( "cppmode", "autoindent", 1 ); buf->offerhelp = mode_util_get_option_with_default ( "cppmode", "offerhelp", 1 ); buf->highlight = mode_util_get_option_with_default ( "cppmode", "highlight", 1 ); buf->flashbrace = mode_util_get_option_with_default ( "cppmode", "flashbrace", 1 ); } buf->mode_name = "cppmode"; buf->state_valid = buf->text; buf->state_valid_num = 0; buf->text->start_state = 0; } void mode_enter(buffer *buf) { mode_util_set_slang_color ( "cppmode", "ident", COLOR_IDENT, COLOR_IDENT_FG, COLOR_IDENT_BG ); mode_util_set_slang_color ( "cppmode", "symbol", COLOR_SYMBOL, COLOR_SYMBOL_FG, COLOR_SYMBOL_BG ); mode_util_set_slang_color ( "cppmode", "brace", COLOR_BRACE, COLOR_BRACE_FG, COLOR_BRACE_BG ); mode_util_set_slang_color ( "cppmode", "comment", COLOR_COMMENT, COLOR_COMMENT_FG, COLOR_COMMENT_BG ); mode_util_set_slang_color ( "cppmode", "keyword", COLOR_KEYWORD, COLOR_KEYWORD_FG, COLOR_KEYWORD_BG ); mode_util_set_slang_color ( "cppmode", "preproc", COLOR_PREPROC, COLOR_PREPROC_FG, COLOR_PREPROC_BG ); mode_util_set_slang_color ( "cppmode", "string", COLOR_STRING, COLOR_STRING_FG, COLOR_STRING_BG ); mode_util_set_slang_color ( "cppmode", "number", COLOR_NUMBER, COLOR_NUMBER_FG, COLOR_NUMBER_BG ); mode_util_set_slang_color ( "cppmode", "stringe", COLOR_STRINGE, COLOR_STRINGE_FG, COLOR_STRINGE_BG ); mode_util_set_slang_color ( "cppmode", "illegal", COLOR_ILLEGAL, COLOR_ILLEGAL_FG, COLOR_ILLEGAL_BG ); mode_util_set_slang_color ( "cppmode", "debug", COLOR_DEBUG, COLOR_DEBUG_FG, COLOR_DEBUG_BG ); } /* C implementation of brace flashing * * Rules: * 1. Braces are (), [], and {}, and they must be properly nested * 2. Ignore anything inside quotation marks (single or double) * 3. Disregard rule 2 if the quote is escaped * 4. Ignore anything in a C-style comment (slash-star) * 5. If currently in a comment, don't match with anything outside of it * 6. Print a silent warning in the minibuf for known mismatched braces */ int mode_flashbrace(buffer *buf) { int is_comment; char brace_stack[1024]; int sp; char ch, quote; if (buf->pos.col == 0) return 0; ch = buf->pos.line->txt[buf->pos.col - 1]; if ((ch != ')') && (ch != ']') && (ch != '}')) return 0; brace_stack[0] = ch; sp = 1; buf->pos.col--; quote = '\0'; is_comment = 0; do { char last_ch; while (buf->pos.col <= 0) { if (buf->pos.line == buf->scrollpos) return 0; buf->pos.line = buf->pos.line->prev; buf->linenum--; buf->pos.col = strlen(buf->pos.line->txt); } buf->pos.col--; last_ch = ch; ch = buf->pos.line->txt[buf->pos.col]; if (is_comment) { if ((ch == '/') && (last_ch == '*')) is_comment = 0; continue; } if (quote != '\0') { if ((ch == '*') && (last_ch == '/')) { is_comment = 1; ch = '\0'; /* must find another '*' to close comment */ } else if (ch == quote) quote = '\0'; else if ((last_ch == quote) && (ch == '\\')) quote = 0; continue; } switch (ch) { case ')': case ']': case '}': if (sp == 1024) return 0; brace_stack[sp++] = ch; break; case '(': if (brace_stack[--sp] != ')') { return -1; } break; case '[': if (brace_stack[--sp] != ']') { return -1; } break; case '{': if (brace_stack[--sp] != '}') { return -1; } break; case '\'': case '\"': quote = ch; break; case '\\': if ((last_ch == '\'') || (last_ch == '\"')) quote = last_ch; break; case '*': if (last_ch == '/') { is_comment = 1; ch = '\0'; /* must find another '*' to close comment */ } break; case '/': if (last_ch == '*') return 0; /* we were in a comment */ break; } } while (sp != 0); set_scr_col(buf); return 1; } enum _states { STATE_BEGIN = 0, STATE_BEGIN1, STATE_WHITESPACE, STATE_WORD, STATE_CAP_L, STATE_SLASH, STATE_COMMENT, STATE_COMMENT_STAR, STATE_COMMENT_DONE, STATE_LINE_COMMENT, STATE_STRING_CONST, STATE_STRING_CONST_ESC, STATE_STRING_CONST_ESCHEX_0, STATE_STRING_CONST_ESCHEX_1, STATE_STRING_CONST_ESCOCT_1, STATE_STRING_CONST_ESCOCT_2, STATE_CHAR_CONST, STATE_CHAR_CONST_ESC, STATE_CHAR_CONST_ESCHEX_0, STATE_CHAR_CONST_ESCHEX_1, STATE_CHAR_CONST_ESCOCT_1, STATE_CHAR_CONST_ESCOCT_2, STATE_LSTRING_CONST, STATE_LSTRING_CONST_ESC, STATE_LSTRING_CONST_ESCHEX_0, STATE_LSTRING_CONST_ESCHEX_1, STATE_LSTRING_CONST_ESCHEX_2, STATE_LSTRING_CONST_ESCHEX_3, STATE_LSTRING_CONST_ESCOCT_1, STATE_LSTRING_CONST_ESCOCT_2, STATE_LSTRING_CONST_ESCOCT_3, STATE_LSTRING_CONST_ESCOCT_4, STATE_LSTRING_CONST_ESCOCT_5, STATE_LCHAR_CONST, STATE_LCHAR_CONST_ESC, STATE_LCHAR_CONST_ESCHEX_0, STATE_LCHAR_CONST_ESCHEX_1, STATE_LCHAR_CONST_ESCHEX_2, STATE_LCHAR_CONST_ESCHEX_3, STATE_LCHAR_CONST_ESCOCT_1, STATE_LCHAR_CONST_ESCOCT_2, STATE_LCHAR_CONST_ESCOCT_3, STATE_LCHAR_CONST_ESCOCT_4, STATE_LCHAR_CONST_ESCOCT_5, STATE_0, STATE_NUM_WHOLE, STATE_NUM_HEX, STATE_NUM_LEAD0_OCT, STATE_NUM_LEAD0, STATE_NUM_SUFF_L, STATE_NUM_SUFF_U, STATE_NUM_SUFF_LU, STATE_DOT, STATE_NUM_FRACT, STATE_FRACT_SUFF_E, STATE_FRACT_SUFF, STATE_FRACT_E_SIGN, STATE_FRACT_E_VAL, STATE_PREPROC, STATE_PREPROC_WORD, STATE_PREPROC_ESC, STATE_PREPROC_SLASH, STATE_COMMENT_PREPROC, STATE_COMMENT_STAR_PREPROC, STATE_COMMENT_DONE_PREPROC, STATE_PANIC }; /* This deserves a little explanation to say the least. This table is used to * compare identifiers against valid keywords and decide whether to color them * as keywords. Keywords are spelled out in columns of the array, and must be * in alphabetical order (by ASCII code -- so capital letters first. The * number, w, is the number of entries in the table, including this one, that * begin with the same sequence of letters. * * For example, since there are four C keywords that begin with the letter 'c', * kwtbl[0][2].w == 4. There are two keywords beginning 'con', and so * kwtbl[2][4].w == 2. */ #define N_KEYWORDS 66 typedef struct { unsigned char ch; unsigned char w; } kwtbl_ent; kwtbl_ent kwtbl[][N_KEYWORDS] = { { {'a',2}, {'a',1}, {'b',4}, {'b',3}, {'b',2}, {'b',1}, {'c',7}, {'c',6}, {'c',5}, {'c',4}, {'c',3}, {'c',2}, {'c',1}, {'d',5}, {'d',4}, {'d',3}, {'d',2}, {'d',1}, {'e',5}, {'e',4}, {'e',3}, {'e',2}, {'e',1}, {'f',5}, {'f',4}, {'f',3}, {'f',2}, {'f',1}, {'g',1}, {'i',3}, {'i',2}, {'i',1}, {'l',1}, {'m',1}, {'n',2}, {'n',1}, {'o',1}, {'p',3}, {'p',2}, {'p',1}, {'r',3}, {'r',2}, {'r',1}, {'s',7}, {'s',6}, {'s',5}, {'s',4}, {'s',3}, {'s',2}, {'s',1}, {'t',9}, {'t',8}, {'t',7}, {'t',6}, {'t',5}, {'t',4}, {'t',3}, {'t',2}, {'t',1}, {'u',3}, {'u',2}, {'u',1}, {'v',3}, {'v',2}, {'v',1}, {'w',1} }, { {'s',1}, {'u',1}, {'a',2}, {'a',1}, {'o',1}, {'r',1}, {'a',2}, {'a',1}, {'h',1}, {'l',1}, {'o',3}, {'o',2}, {'o',1}, {'e',2}, {'e',1}, {'o',2}, {'o',1}, {'y',1}, {'l',1}, {'n',1}, {'x',3}, {'x',2}, {'x',1}, {'a',1}, {'i',1}, {'l',1}, {'o',1}, {'r',1}, {'o',1}, {'f',1}, {'n',2}, {'n',1}, {'o',1}, {'u',1}, {'a',1}, {'e',1}, {'p',1}, {'r',2}, {'r',1}, {'u',1}, {'e',3}, {'e',2}, {'e',1}, {'h',1}, {'i',2}, {'i',1}, {'t',3}, {'t',2}, {'t',1}, {'w',1}, {'e',1}, {'h',2}, {'h',1}, {'r',2}, {'r',1}, {'y',4}, {'y',3}, {'y',2}, {'y',1}, {'n',2}, {'n',1}, {'s',1}, {'i',1}, {'o',2}, {'o',1}, {'h',1} }, { {'m',1}, {'t',1}, {'d',2}, {'d',1}, {'o',1}, {'e',1}, {'s',1}, {'t',1}, {'a',1}, {'a',1}, {'n',3}, {'n',2}, {'n',1}, {'f',1}, {'l',1}, {' ',0}, {'u',1}, {'n',1}, {'s',1}, {'u',1}, {'c',1}, {'p',1}, {'t',1}, {'l',1}, {'n',1}, {'o',1}, {'r',1}, {'i',1}, {'t',1}, {' ',0}, {'l',1}, {'t',1}, {'n',1}, {'t',1}, {'m',1}, {'w',1}, {'e',1}, {'i',1}, {'o',1}, {'b',1}, {'g',1}, {'i',1}, {'t',1}, {'o',1}, {'g',1}, {'z',1}, {'a',2}, {'a',1}, {'r',1}, {'i',1}, {'m',1}, {'i',1}, {'r',1}, {'u',1}, {'y',1}, {'p',4}, {'p',3}, {'p',2}, {'p',1}, {'i',1}, {'s',1}, {'i',1}, {'r',1}, {'i',1}, {'l',1}, {'i',1} }, { {' ',0}, {'o',1}, {'_',2}, {'_',1}, {'l',1}, {'a',1}, {'e',1}, {'c',1}, {'r',1}, {'s',1}, {'s',2}, {'s',1}, {'t',1}, {'a',1}, {'e',1}, {' ',0}, {'b',1}, {'a',1}, {'e',1}, {'m',1}, {'e',1}, {'l',1}, {'e',1}, {'s',1}, {'a',1}, {'a',1}, {' ',0}, {'e',1}, {'o',1}, {' ',0}, {'i',1}, {' ',0}, {'g',1}, {'a',1}, {'e',1}, {' ',0}, {'r',1}, {'v',1}, {'t',1}, {'l',1}, {'i',1}, {'n',1}, {'u',1}, {'r',1}, {'n',1}, {'e',1}, {'t',2}, {'t',1}, {'u',1}, {'t',1}, {'p',1}, {'s',1}, {'o',1}, {'e',1}, {' ',0}, {'e',4}, {'e',3}, {'e',2}, {'e',1}, {'o',1}, {'i',1}, {'n',1}, {'t',1}, {'d',1}, {'a',1}, {'l',1} }, { {' ',0}, {' ',0}, {'c',1}, {'t',1}, {' ',0}, {'k',1}, {' ',0}, {'h',1}, {' ',0}, {'s',1}, {'t',2}, {'t',1}, {'i',1}, {'u',1}, {'t',1}, {' ',0}, {'l',1}, {'m',1}, {' ',0}, {' ',0}, {'p',1}, {'i',1}, {'r',1}, {'e',1}, {'l',1}, {'t',1}, {' ',0}, {'n',1}, {' ',0}, {' ',0}, {'n',1}, {' ',0}, {' ',0}, {'b',1}, {'s',1}, {' ',0}, {'a',1}, {'a',1}, {'e',1}, {'i',1}, {'s',1}, {'t',1}, {'r',1}, {'t',1}, {'e',1}, {'o',1}, {'i',2}, {'i',1}, {'c',1}, {'c',1}, {'l',1}, {' ',0}, {'w',1}, {' ',0}, {' ',0}, {'_',1}, {'d',1}, {'i',1}, {'n',1}, {'n',1}, {'g',1}, {'g',1}, {'u',1}, {' ',0}, {'t',1}, {'e',1} }, { {' ',0}, {' ',0}, {'a',1}, {'y',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'_',1}, {'n',1}, {'l',1}, {'e',1}, {' ',0}, {'e',1}, {'i',1}, {' ',0}, {' ',0}, {'t',1}, {'c',1}, {'n',1}, {' ',0}, {'l',1}, {' ',0}, {' ',0}, {'d',1}, {' ',0}, {' ',0}, {'e',1}, {' ',0}, {' ',0}, {'l',1}, {'p',1}, {' ',0}, {'t',1}, {'t',1}, {'c',1}, {'c',1}, {'t',1}, {'e',1}, {'n',1}, {' ',0}, {'d',1}, {'f',1}, {'c',2}, {'c',1}, {'t',1}, {'h',1}, {'a',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'i',1}, {'e',1}, {'d',1}, {'a',1}, {' ',0}, {'n',1}, {' ',0}, {'a',1}, {' ',0}, {'i',1}, {' ',0} }, { {' ',0}, {' ',0}, {'s',1}, {'p',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'c',1}, {'u',1}, {'t',1}, {' ',0}, {' ',0}, {' ',0}, {'c',1}, {' ',0}, {' ',0}, {' ',0}, {'i',1}, {' ',0}, {' ',0}, {'y',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'e',1}, {'a',1}, {' ',0}, {'o',1}, {'e',1}, {'t',1}, {' ',0}, {'e',1}, {'r',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'_',1}, {' ',0}, {' ',0}, {'t',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'n',1}, {'f',1}, {' ',0}, {'m',1}, {' ',0}, {'e',1}, {' ',0}, {'l',1}, {' ',0}, {'l',1}, {' ',0} }, { {' ',0}, {' ',0}, {'t',1}, {'e',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'a',1}, {'e',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'_',1}, {' ',0}, {' ',0}, {' ',0}, {'t',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'c',1}, {' ',0}, {'r',1}, {' ',0}, {'e',1}, {' ',0}, {'r',1}, {'p',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'c',1}, {' ',0}, {' ',0}, {'e',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'f',1}, {' ',0}, {' ',0}, {'e',1}, {' ',0}, {'d',1}, {' ',0}, {' ',0}, {' ',0}, {'e',1}, {' ',0} }, { {' ',0}, {' ',0}, {' ',0}, {'i',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'s',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'c',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'e',1}, {' ',0}, {' ',0}, {' ',0}, {'d',1}, {' ',0}, {' ',0}, {'r',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'a',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'o',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0} }, { {' ',0}, {' ',0}, {' ',0}, {'d',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'t',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'a',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'e',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'s',1}, {' ',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}, {'s',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'t',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'t',1}, {' ',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}, {'t',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'_',1}, {' ',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}, {' ',0}, {' ',0}, {'c',1}, {' ',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}, {' ',0}, {' ',0}, {'a',1}, {' ',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}, {' ',0}, {' ',0}, {'s',1}, {' ',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}, {' ',0}, {' ',0}, {'t',1}, {' ',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}, {' ',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} } }; /* Modifies the values of kwpos and kwend with respect to the next character of * an identifier. kwpos points to the current position in the keyword table; * kwend to the first invalid position; n is the number of characters already * processed; and ch is the next character to process. The function will * update *kwpos and *kwend to take into account the new character. It will * set *kwpos to -1 if it determines that the word is not a keyword. */ static void check_kw(int *kwpos, int *kwend, int n, char ch) { int i; if (*kwpos == -1) return; while ((kwtbl[n][*kwpos].w == 0) && (*kwpos < *kwend)) (*kwpos)++; for (i = *kwpos; i < *kwend; i += kwtbl[n][i].w) if (ch == kwtbl[n][i].ch) break; if (i < *kwend) { *kwpos = i; *kwend = i + kwtbl[n][i].w; } else *kwpos = -1; } /* Utility function that does most of the work of the highlighter. It scans * the text using something resembling a DFA-based lexical scanner, except that * keywords are read from the table described above. The text to scan is * passed in txt, and pointers to variables containing a starting position and * starting state in idx and state. On return, idx and state are updated to * reflaect the next place to start scanning, and the return value is the * palette index to use when drawing the text. */ static int get_color(char *txt, int *idx, int *state) { int start_idx; int kwpos, kwend; kwpos = 0; kwend = N_KEYWORDS; start_idx = *idx; while (1) /* loop until we return a color */ { switch (*state) { case STATE_BEGIN1: if (txt[*idx] == '#') { (*idx)++; return COLOR_SYMBOL; } case STATE_BEGIN: if (isspace(txt[*idx])) { *state = STATE_WHITESPACE; (*idx)++; } /* A capital L is treated here as special because it can be the * introduction to a wide string or character constant and thus * not a word at all! */ else if (isalpha(txt[*idx]) || (txt[*idx] == '_')) { check_kw(&kwpos, &kwend, 0, txt[*idx]); if (txt[*idx] == 'L') *state = STATE_CAP_L; else *state = STATE_WORD; (*idx)++; } else switch (txt[*idx]) { case '0': *state = STATE_0; (*idx)++; break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': *state = STATE_NUM_WHOLE; (*idx)++; break; case '#': *state = STATE_PREPROC; (*idx)++; break; case '.': *state = STATE_DOT; (*idx)++; break; case '/': *state = STATE_SLASH; (*idx)++; break; case '\"': *state = STATE_STRING_CONST; (*idx)++; break; case '\'': *state = STATE_CHAR_CONST; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_IDENT; case '(': case '[': case '{': case '}': case ']': case ')': (*idx)++; if (txt[*idx] == '\0') *state = STATE_BEGIN; else *state = STATE_BEGIN1; return COLOR_BRACE; default: (*idx)++; if (txt[*idx] == '\0') *state = STATE_BEGIN; else *state = STATE_BEGIN1; return COLOR_SYMBOL; } break; case STATE_WHITESPACE: while (isspace(txt[*idx])) (*idx)++; if (txt[*idx] == '\0') { *state = STATE_BEGIN; return COLOR_IDENT; } else { *state = STATE_BEGIN1; return COLOR_IDENT; } case STATE_WORD: while (isalnum(txt[*idx]) || (txt[*idx] == '_')) { check_kw(&kwpos, &kwend, (*idx) - start_idx, txt[*idx]); (*idx)++; } if (txt[*idx] == '\0') *state = STATE_BEGIN; else *state = STATE_BEGIN1; if ((kwpos != -1) && (kwtbl[*idx - start_idx][kwpos].w == 0)) return COLOR_KEYWORD; else return COLOR_IDENT; case STATE_CAP_L: if (isalnum(txt[*idx]) || (txt[*idx] == '_')) { check_kw(&kwpos, &kwend, (*idx) - start_idx, txt[*idx]); *state = STATE_WORD; (*idx)++; } else switch (txt[*idx]) { case '\"': *state = STATE_LSTRING_CONST; (*idx)++; break; case '\'': *state = STATE_LCHAR_CONST; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_IDENT; default: *state = STATE_BEGIN1; return COLOR_IDENT; } break; case STATE_SLASH: switch (txt[*idx]) { case '*': *state = STATE_COMMENT; (*idx)++; break; case '/': *state = STATE_LINE_COMMENT; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_SYMBOL; default: *state = STATE_BEGIN1; return COLOR_SYMBOL; } break; case STATE_COMMENT: switch (txt[*idx]) { case '*': *state = STATE_COMMENT_STAR; (*idx)++; break; case '\0': return COLOR_COMMENT; default: (*idx)++; } break; case STATE_COMMENT_STAR: switch (txt[*idx]) { case '/': *state = STATE_COMMENT_DONE; (*idx)++; break; case '*': (*idx)++; break; case '\0': *state = STATE_COMMENT; return COLOR_COMMENT; default: *state = STATE_COMMENT; (*idx)++; } break; case STATE_COMMENT_DONE: if (txt[*idx] == '\0') { *state = STATE_BEGIN; return COLOR_COMMENT; } else { *state = STATE_BEGIN1; return COLOR_COMMENT; } case STATE_LINE_COMMENT: if (txt[*idx] == '\0') { *state = STATE_BEGIN; return COLOR_COMMENT; } else (*idx)++; break; case STATE_STRING_CONST: switch (txt[*idx]) { case '\"': (*idx)++; if (txt[*idx] == '\0') *state = STATE_BEGIN; else *state = STATE_BEGIN1; return COLOR_STRING; case '\\': *state = STATE_STRING_CONST_ESC; return COLOR_STRING; case '\0': return COLOR_STRING; default: (*idx)++; } break; case STATE_STRING_CONST_ESC: (*idx)++; switch (txt[*idx]) { case '\0': *state = STATE_STRING_CONST; return COLOR_STRINGE; case 'x': *state = STATE_STRING_CONST_ESCHEX_0; (*idx)++; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_STRING_CONST_ESCOCT_1; (*idx)++; break; case 'a': case 'b': case 'f': case 'n': case 'r': case 't': case 'v': case '\\': case '\'': case '\"': case '?': *state = STATE_STRING_CONST; (*idx)++; return COLOR_STRINGE; default: *state = STATE_STRING_CONST; (*idx)++; return COLOR_ILLEGAL; } break; case STATE_STRING_CONST_ESCHEX_0: if (isxdigit(txt[*idx])) { *state = STATE_STRING_CONST_ESCHEX_1; (*idx)++; } else { *state = STATE_STRING_CONST; return COLOR_ILLEGAL; } break; case STATE_STRING_CONST_ESCHEX_1: if (isxdigit(txt[*idx])) (*idx)++; *state = STATE_STRING_CONST; return COLOR_STRINGE; case STATE_STRING_CONST_ESCOCT_1: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_STRING_CONST_ESCOCT_2; (*idx)++; break; default: *state = STATE_STRING_CONST; return COLOR_STRINGE; } break; case STATE_STRING_CONST_ESCOCT_2: if ((txt[*idx] >= '0') && (txt[*idx] <= '7')) (*idx)++; *state = STATE_STRING_CONST; return COLOR_STRINGE; case STATE_CHAR_CONST: switch (txt[*idx]) { case '\'': (*idx)++; if (txt[*idx] == '\0') *state = STATE_BEGIN; else *state = STATE_BEGIN1; return COLOR_STRING; case '\\': *state = STATE_CHAR_CONST_ESC; return COLOR_STRING; case '\0': *state = STATE_BEGIN; return COLOR_STRING; default: (*idx)++; } break; case STATE_CHAR_CONST_ESC: (*idx)++; switch (txt[*idx]) { case '\0': *state = STATE_CHAR_CONST; return COLOR_STRINGE; case 'x': *state = STATE_CHAR_CONST_ESCHEX_0; (*idx)++; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_CHAR_CONST_ESCOCT_1; (*idx)++; break; case 'a': case 'b': case 'f': case 'n': case 'r': case 't': case 'v': case '\\': case '\'': case '\"': case '?': *state = STATE_CHAR_CONST; (*idx)++; return COLOR_STRINGE; default: *state = STATE_CHAR_CONST; (*idx)++; return COLOR_ILLEGAL; } break; case STATE_CHAR_CONST_ESCHEX_0: if (isxdigit(txt[*idx])) { *state = STATE_CHAR_CONST_ESCHEX_1; (*idx)++; } else { *state = STATE_CHAR_CONST; return COLOR_ILLEGAL; } break; case STATE_CHAR_CONST_ESCHEX_1: if (isxdigit(txt[*idx])) (*idx)++; *state = STATE_CHAR_CONST; return COLOR_STRINGE; case STATE_CHAR_CONST_ESCOCT_1: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_CHAR_CONST_ESCOCT_2; (*idx)++; break; default: *state = STATE_CHAR_CONST; return COLOR_STRINGE; } break; case STATE_CHAR_CONST_ESCOCT_2: if ((txt[*idx] >= '0') && (txt[*idx] <= '7')) (*idx)++; *state = STATE_CHAR_CONST; return COLOR_STRINGE; case STATE_LSTRING_CONST: switch (txt[*idx]) { case '\"': (*idx)++; if (txt[*idx] == '\0') *state = STATE_BEGIN; else *state = STATE_BEGIN1; return COLOR_STRING; case '\\': *state = STATE_LSTRING_CONST_ESC; return COLOR_STRING; case '\0': return COLOR_STRING; default: (*idx)++; } break; case STATE_LSTRING_CONST_ESC: (*idx)++; switch (txt[*idx]) { case '\0': *state = STATE_LSTRING_CONST; return COLOR_STRINGE; case 'x': *state = STATE_LSTRING_CONST_ESCHEX_0; (*idx)++; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_LSTRING_CONST_ESCOCT_1; (*idx)++; break; case 'a': case 'b': case 'f': case 'n': case 'r': case 't': case 'v': case '\\': case '\'': case '\"': case '?': *state = STATE_LSTRING_CONST; (*idx)++; return COLOR_STRINGE; default: *state = STATE_LSTRING_CONST; (*idx)++; return COLOR_ILLEGAL; } break; case STATE_LSTRING_CONST_ESCHEX_0: if (isxdigit(txt[*idx])) { *state = STATE_LSTRING_CONST_ESCHEX_1; (*idx)++; } else { *state = STATE_LSTRING_CONST; return COLOR_ILLEGAL; } break; case STATE_LSTRING_CONST_ESCHEX_1: if (isxdigit(txt[*idx])) { *state = STATE_LSTRING_CONST_ESCHEX_2; (*idx)++; } else { *state = STATE_LSTRING_CONST; return COLOR_STRINGE; } break; case STATE_LSTRING_CONST_ESCHEX_2: if (isxdigit(txt[*idx])) { *state = STATE_LSTRING_CONST_ESCHEX_3; (*idx)++; } else { *state = STATE_LSTRING_CONST; return COLOR_STRINGE; } break; case STATE_LSTRING_CONST_ESCHEX_3: if (isxdigit(txt[*idx])) (*idx)++; *state = STATE_LSTRING_CONST; return COLOR_STRINGE; case STATE_LSTRING_CONST_ESCOCT_1: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_LSTRING_CONST_ESCOCT_2; (*idx)++; break; default: *state = STATE_LSTRING_CONST; return COLOR_STRINGE; } break; case STATE_LSTRING_CONST_ESCOCT_2: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_LSTRING_CONST_ESCOCT_3; (*idx)++; break; default: *state = STATE_LSTRING_CONST; return COLOR_STRINGE; } break; case STATE_LSTRING_CONST_ESCOCT_3: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_LSTRING_CONST_ESCOCT_4; (*idx)++; break; default: *state = STATE_LSTRING_CONST; return COLOR_STRINGE; } break; case STATE_LSTRING_CONST_ESCOCT_4: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_LSTRING_CONST_ESCOCT_5; (*idx)++; break; default: *state = STATE_LSTRING_CONST; return COLOR_STRINGE; } break; case STATE_LSTRING_CONST_ESCOCT_5: if ((txt[*idx] >= '0') && (txt[*idx] <= '7')) (*idx)++; *state = STATE_LSTRING_CONST; return COLOR_STRINGE; case STATE_LCHAR_CONST: switch (txt[*idx]) { case '\'': (*idx)++; if (txt[*idx] == '\0') *state = STATE_BEGIN; else *state = STATE_BEGIN1; return COLOR_STRING; case '\\': *state = STATE_LCHAR_CONST_ESC; return COLOR_STRING; case '\0': *state = STATE_BEGIN; return COLOR_STRING; default: (*idx)++; } break; case STATE_LCHAR_CONST_ESC: (*idx)++; switch (txt[*idx]) { case '\0': *state = STATE_LCHAR_CONST; return COLOR_STRINGE; case 'x': *state = STATE_LCHAR_CONST_ESCHEX_0; (*idx)++; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_LCHAR_CONST_ESCOCT_1; (*idx)++; break; case 'a': case 'b': case 'f': case 'n': case 'r': case 't': case 'v': case '\\': case '\'': case '\"': case '?': *state = STATE_LCHAR_CONST; (*idx)++; return COLOR_STRINGE; default: *state = STATE_LCHAR_CONST; (*idx)++; return COLOR_ILLEGAL; } break; case STATE_LCHAR_CONST_ESCHEX_0: if (isxdigit(txt[*idx])) { *state = STATE_LCHAR_CONST_ESCHEX_1; (*idx)++; } else { *state = STATE_LCHAR_CONST; return COLOR_ILLEGAL; } break; case STATE_LCHAR_CONST_ESCHEX_1: if (isxdigit(txt[*idx])) { *state = STATE_LCHAR_CONST_ESCHEX_2; (*idx)++; } else { *state = STATE_LCHAR_CONST; return COLOR_STRINGE; } break; case STATE_LCHAR_CONST_ESCHEX_2: if (isxdigit(txt[*idx])) { *state = STATE_LCHAR_CONST_ESCHEX_3; (*idx)++; } else { *state = STATE_LCHAR_CONST; return COLOR_STRINGE; } break; case STATE_LCHAR_CONST_ESCHEX_3: if (isxdigit(txt[*idx])) (*idx)++; *state = STATE_LCHAR_CONST; return COLOR_STRINGE; case STATE_LCHAR_CONST_ESCOCT_1: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_LCHAR_CONST_ESCOCT_2; (*idx)++; break; default: *state = STATE_LCHAR_CONST; return COLOR_STRINGE; } break; case STATE_LCHAR_CONST_ESCOCT_2: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_LCHAR_CONST_ESCOCT_3; (*idx)++; break; default: *state = STATE_LCHAR_CONST; return COLOR_STRINGE; } break; case STATE_LCHAR_CONST_ESCOCT_3: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_LCHAR_CONST_ESCOCT_4; (*idx)++; break; default: *state = STATE_LCHAR_CONST; return COLOR_STRINGE; } break; case STATE_LCHAR_CONST_ESCOCT_4: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_LCHAR_CONST_ESCOCT_5; (*idx)++; break; default: *state = STATE_LCHAR_CONST; return COLOR_STRINGE; } break; case STATE_LCHAR_CONST_ESCOCT_5: if ((txt[*idx] >= '0') && (txt[*idx] <= '7')) (*idx)++; *state = STATE_LCHAR_CONST; return COLOR_STRINGE; case STATE_0: switch (txt[*idx]) { case 'x': case 'X': *state = STATE_NUM_HEX; (*idx)++; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_NUM_LEAD0_OCT; (*idx)++; break; case '8': case '9': *state = STATE_NUM_LEAD0; (*idx)++; break; case '.': *state = STATE_NUM_FRACT; (*idx)++; break; case 'L': case 'l': *state = STATE_NUM_SUFF_L; (*idx)++; break; case 'U': case 'u': *state = STATE_NUM_SUFF_U; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalpha(txt[*idx]) || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN1; return COLOR_NUMBER; } } break; case STATE_NUM_HEX: if (isxdigit(txt[*idx])) { (*idx)++; } else switch (txt[*idx]) { case 'L': case 'l': *state = STATE_NUM_SUFF_L; (*idx)++; break; case 'U': case 'u': *state = STATE_NUM_SUFF_U; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalpha(txt[*idx]) || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN1; return COLOR_NUMBER; } } break; case STATE_NUM_WHOLE: while (isdigit(txt[*idx])) (*idx)++; switch (txt[*idx]) { case '.': *state = STATE_NUM_FRACT; (*idx)++; break; case 'L': case 'l': *state = STATE_NUM_SUFF_L; (*idx)++; break; case 'U': case 'u': *state = STATE_NUM_SUFF_U; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalpha(txt[*idx]) || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN1; return COLOR_NUMBER; } } break; case STATE_PREPROC: while (isspace(txt[*idx])) (*idx)++; if (isalpha(txt[*idx]) || (txt[*idx] == '_')) { *state = STATE_PREPROC_WORD; (*idx)++; } else switch (txt[*idx]) { case '/': *state = STATE_PREPROC_SLASH; return COLOR_PREPROC; case '\\': *state = STATE_PREPROC_ESC; return COLOR_PREPROC; case '\0': *state = STATE_BEGIN; return COLOR_PREPROC; default: *state = STATE_BEGIN1; return COLOR_PREPROC; } break; case STATE_DOT: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': *state = STATE_NUM_FRACT; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_SYMBOL; default: *state = STATE_BEGIN1; return COLOR_SYMBOL; } break; case STATE_NUM_LEAD0_OCT: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': (*idx)++; break; case '8': case '9': *state = STATE_NUM_LEAD0; (*idx)++; break; case '.': *state = STATE_NUM_FRACT; (*idx)++; break; case 'L': case 'l': *state = STATE_NUM_SUFF_L; (*idx)++; break; case 'U': case 'u': *state = STATE_NUM_SUFF_U; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalpha(txt[*idx]) || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN1; return COLOR_NUMBER; } } break; case STATE_NUM_LEAD0: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': (*idx)++; break; case '.': *state = STATE_NUM_FRACT; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_ILLEGAL; default: *state = STATE_PANIC; } break; case STATE_NUM_FRACT: while (isdigit(txt[*idx])) (*idx)++; switch (txt[*idx]) { case 'E': case 'e': *state = STATE_FRACT_SUFF_E; (*idx)++; break; case 'F': case 'f': case 'L': case 'l': *state = STATE_FRACT_SUFF; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalpha(txt[*idx]) || (txt[*idx] == '_') || (txt[*idx] == '.')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN1; return COLOR_NUMBER; } } break; case STATE_NUM_SUFF_L: switch (txt[*idx]) { case 'U': case 'u': *state = STATE_NUM_SUFF_LU; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalnum(txt[*idx]) || (txt[*idx] == '.') || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN1; return COLOR_NUMBER; } } break; case STATE_NUM_SUFF_U: switch (txt[*idx]) { case 'L': case 'l': *state = STATE_NUM_SUFF_LU; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalnum(txt[*idx]) || (txt[*idx] == '.') || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN1; return COLOR_NUMBER; } } break; case STATE_NUM_SUFF_LU: switch (txt[*idx]) { case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalnum(txt[*idx]) || (txt[*idx] == '.') || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN1; return COLOR_NUMBER; } } break; case STATE_FRACT_SUFF_E: if (isdigit(txt[*idx])) { *state = STATE_FRACT_E_VAL; (*idx)++; } else if (isalpha(txt[*idx]) || (txt[*idx] == '.') || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else switch (txt[*idx]) { case '+': case '-': *state = STATE_FRACT_E_SIGN; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_ILLEGAL; default: *state = STATE_BEGIN1; return COLOR_ILLEGAL; } break; case STATE_FRACT_E_SIGN: if (isdigit(txt[*idx])) { *state = STATE_FRACT_E_VAL; (*idx)++; } else if (isalpha(txt[*idx]) || (txt[*idx] == '.') || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else switch (txt[*idx]) { case '\0': *state = STATE_BEGIN; return COLOR_ILLEGAL; default: *state = STATE_BEGIN1; return COLOR_ILLEGAL; } break; case STATE_FRACT_E_VAL: while (isdigit(txt[*idx])) (*idx)++; switch (txt[*idx]) { case 'F': case 'f': case 'L': case 'l': *state = STATE_FRACT_SUFF; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalpha(txt[*idx]) || (txt[*idx] == '.') || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN1; return COLOR_NUMBER; } } break; case STATE_FRACT_SUFF: if (isalnum(txt[*idx]) || (txt[*idx] == '.') || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else if (txt[*idx] == '\0') { *state = STATE_BEGIN; return COLOR_NUMBER; } else { *state = STATE_BEGIN1; return COLOR_NUMBER; } break; case STATE_PREPROC_WORD: while (isalnum(txt[*idx]) || (txt[*idx] == '_')) (*idx)++; if (txt[*idx] == '\0') { *state = STATE_BEGIN; return COLOR_PREPROC; } else { *state = STATE_BEGIN1; return COLOR_PREPROC; } case STATE_PREPROC_ESC: (*idx)++; if (txt[*idx] == '\0') { *state = STATE_PREPROC; return COLOR_PREPROC; } else { *state = STATE_BEGIN1; return COLOR_SYMBOL; } case STATE_PREPROC_SLASH: (*idx)++; switch (txt[*idx]) { case '*': *state = STATE_COMMENT_PREPROC; (*idx)++; break; case '/': *state = STATE_LINE_COMMENT; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_SYMBOL; default: *state = STATE_BEGIN1; return COLOR_SYMBOL; } break; case STATE_COMMENT_PREPROC: switch (txt[*idx]) { case '*': *state = STATE_COMMENT_STAR_PREPROC; (*idx)++; break; case '\0': return COLOR_COMMENT; default: (*idx)++; } break; case STATE_COMMENT_STAR_PREPROC: switch (txt[*idx]) { case '/': *state = STATE_COMMENT_DONE_PREPROC; (*idx)++; break; case '*': (*idx)++; break; case '\0': *state = STATE_COMMENT_PREPROC; return COLOR_COMMENT; default: *state = STATE_COMMENT_PREPROC; (*idx)++; } break; case STATE_COMMENT_DONE_PREPROC: switch (txt[*idx]) { case '\0': *state = STATE_BEGIN; return COLOR_COMMENT; default: *state = STATE_PREPROC; return COLOR_COMMENT; } case STATE_PANIC: while (isalnum(txt[*idx]) || (txt[*idx] == '_')) (*idx)++; if (txt[*idx] == '\0') { *state = STATE_BEGIN; return COLOR_ILLEGAL; } else { *state = STATE_BEGIN1; return COLOR_ILLEGAL; } default: while (txt[*idx] != '\0') (*idx)++; return COLOR_DEBUG; } } return COLOR_IDENT; } /* The exported syntax highlighter function. This function itself really only * exists to take care of a few loose ends. In fact, these loose ends are * common to all languages, so this code should probably be moved to screen.c * instead of put here. But that's not possible now because the perl and SGML * modules act differently. As soon as I get all this stuff working the same, * I'll move stuff around to avoid duplicating code. */ int mode_highlight(buffer *buf, buf_line *ln, int lnum, int *idx, int *state) { if (*state == -1) { int i, pos; char *c; while (buf->state_valid_num < lnum) { c = buf->state_valid->txt; pos = 0; *state = buf->state_valid->start_state; do get_color(c, &pos, state); while (c[pos] != '\0'); buf->state_valid = buf->state_valid->next; buf->state_valid_num++; buf->state_valid->start_state = *state; } c = ln->txt; i = 0; *state = ln->start_state; while (i < *idx) get_color(c, &i, state); } return get_color(ln->txt, idx, state); } lpe-1.2.7/src/modes/Makefile.am0000644000175000017500000000235007135113052015150 0ustar adammadammMAINTAINERCLEANFILES = Makefile.in INCLUDES = -I$(top_srcdir)/src liblpedir = $(libdir)/lpe liblpe_LTLIBRARIES = @MODES@ EXTRA_LTLIBRARIES = \ cmode.la cppmode.la perlmode.la htmlmode.la sgmlmode.la \ mailmode.la javamode.la lispmode.la cmode_la_SOURCES = cmode.c cmode_la_LDFLAGS = -no-undefined -avoid-version -module -export-dynamic -rpath $(liblpedir) cppmode_la_SOURCES = cppmode.c cppmode_la_LDFLAGS = -no-undefined -avoid-version -module -export-dynamic -rpath $(liblpedir) perlmode_la_SOURCES = perlmode.c perlmode_la_LDFLAGS = -no-undefined -avoid-version -module -export-dynamic -rpath $(liblpedir) htmlmode_la_SOURCES = htmlmode.c htmlmode_la_LDFLAGS = -no-undefined -avoid-version -module -export-dynamic -rpath $(liblpedir) sgmlmode_la_SOURCES = sgmlmode.c sgmlmode_la_LDFLAGS = -no-undefined -avoid-version -module -export-dynamic -rpath $(liblpedir) mailmode_la_SOURCES = mailmode.c mailmode_la_LDFLAGS = -no-undefined -avoid-version -module -export-dynamic -rpath $(liblpedir) javamode_la_SOURCES = javamode.c javamode_la_LDFLAGS = -no-undefined -avoid-version -module -export-dynamic -rpath $(liblpedir) lispmode_la_SOURCES = lispmode.c lispmode_la_LDFLAGS = -no-undefined -avoid-version -module -export-dynamic -rpath $(liblpedir) lpe-1.2.7/src/modes/cmode.c0000644000175000017500000016121007136076546014371 0ustar adammadamm/* cmode.c * * Copyright (c) 1999 Chris Smith * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #include #include #include "lpecomm.h" #include "highlight.h" #include "mode-utils.h" int mode_accept(buffer *buf) { char *suffix; suffix = strrchr(buf->name, '.'); if (suffix == NULL) return 0; return mode_util_accept_extensions ( suffix, 0, 2, ".c", ".h" ) || mode_util_accept_on_request ( buf->text->txt, 0, 2, "c", "c-source" ); } void mode_init(buffer *buf) { if (buf->mode_name == NULL) { buf->hardtab = mode_util_get_option_with_default ( "cmode", "hardtab", 1 ); buf->autoindent = mode_util_get_option_with_default ( "cmode", "autoindent", 1 ); buf->offerhelp = mode_util_get_option_with_default ( "cmode", "offerhelp", 1 ); buf->highlight = mode_util_get_option_with_default ( "cmode", "highlight", 1 ); buf->flashbrace = mode_util_get_option_with_default ( "cmode", "flashbrace", 1 ); } buf->mode_name = "cmode"; buf->state_valid = buf->text; buf->state_valid_num = 0; buf->text->start_state = 0; } void mode_enter(buffer *buf) { mode_util_set_slang_color ( "cmode", "ident", COLOR_IDENT, COLOR_IDENT_FG, COLOR_IDENT_BG ); mode_util_set_slang_color ( "cmode", "symbol", COLOR_SYMBOL, COLOR_SYMBOL_FG, COLOR_SYMBOL_BG ); mode_util_set_slang_color ( "cmode", "brace", COLOR_BRACE, COLOR_BRACE_FG, COLOR_BRACE_BG ); mode_util_set_slang_color ( "cmode", "comment", COLOR_COMMENT, COLOR_COMMENT_FG, COLOR_COMMENT_BG ); mode_util_set_slang_color ( "cmode", "keyword", COLOR_KEYWORD, COLOR_KEYWORD_FG, COLOR_KEYWORD_BG ); mode_util_set_slang_color ( "cmode", "preproc", COLOR_PREPROC, COLOR_PREPROC_FG, COLOR_PREPROC_BG ); mode_util_set_slang_color ( "cmode", "string", COLOR_STRING, COLOR_STRING_FG, COLOR_STRING_BG ); mode_util_set_slang_color ( "cmode", "number", COLOR_NUMBER, COLOR_NUMBER_FG, COLOR_NUMBER_BG ); mode_util_set_slang_color ( "cmode", "stringe", COLOR_STRINGE, COLOR_STRINGE_FG, COLOR_STRINGE_BG ); mode_util_set_slang_color ( "cmode", "illegal", COLOR_ILLEGAL, COLOR_ILLEGAL_FG, COLOR_ILLEGAL_BG ); mode_util_set_slang_color ( "cmode", "debug", COLOR_DEBUG, COLOR_DEBUG_FG, COLOR_DEBUG_BG ); } /* C implementation of brace flashing * * Rules: * 1. Braces are (), [], and {}, and they must be properly nested * 2. Ignore anything inside quotation marks (single or double) * 3. Disregard rule 2 if the quote is escaped * 4. Ignore anything in a C-style comment (slash-star) * 5. If currently in a comment, don't match with anything outside of it * 6. Print a silent warning in the minibuf for known mismatched braces */ int mode_flashbrace(buffer *buf) { int is_comment; char brace_stack[1024]; int sp; char ch, quote; if (buf->pos.col == 0) return 0; ch = buf->pos.line->txt[buf->pos.col - 1]; if ((ch != ')') && (ch != ']') && (ch != '}')) return 0; brace_stack[0] = ch; sp = 1; buf->pos.col--; quote = '\0'; is_comment = 0; do { char last_ch; while (buf->pos.col <= 0) { if (buf->pos.line == buf->scrollpos) return 0; buf->pos.line = buf->pos.line->prev; buf->linenum--; buf->pos.col = strlen(buf->pos.line->txt); } buf->pos.col--; last_ch = ch; ch = buf->pos.line->txt[buf->pos.col]; if (is_comment) { if ((ch == '/') && (last_ch == '*')) is_comment = 0; continue; } if (quote != '\0') { if ((ch == '*') && (last_ch == '/')) { is_comment = 1; ch = '\0'; /* must find another '*' to close comment */ } else if (ch == quote) quote = '\0'; else if ((last_ch == quote) && (ch == '\\')) quote = 0; continue; } switch (ch) { case ')': case ']': case '}': if (sp == 1024) return 0; brace_stack[sp++] = ch; break; case '(': if (brace_stack[--sp] != ')') { return -1; } break; case '[': if (brace_stack[--sp] != ']') { return -1; } break; case '{': if (brace_stack[--sp] != '}') { return -1; } break; case '\'': case '\"': quote = ch; break; case '\\': if ((last_ch == '\'') || (last_ch == '\"')) quote = last_ch; break; case '*': if (last_ch == '/') { is_comment = 1; ch = '\0'; /* must find another '*' to close comment */ } break; case '/': if (last_ch == '*') return 0; /* we were in a comment */ break; } } while (sp != 0); set_scr_col(buf); return 1; } enum _states { STATE_BEGIN = 0, STATE_BEGIN1, STATE_WHITESPACE, STATE_WORD, STATE_CAP_L, STATE_SLASH, STATE_COMMENT, STATE_COMMENT_STAR, STATE_COMMENT_DONE, STATE_STRING_CONST, STATE_STRING_CONST_ESC, STATE_STRING_CONST_ESCHEX_0, STATE_STRING_CONST_ESCHEX_1, STATE_STRING_CONST_ESCOCT_1, STATE_STRING_CONST_ESCOCT_2, STATE_CHAR_CONST, STATE_CHAR_CONST_ESC, STATE_CHAR_CONST_ESCHEX_0, STATE_CHAR_CONST_ESCHEX_1, STATE_CHAR_CONST_ESCOCT_1, STATE_CHAR_CONST_ESCOCT_2, STATE_LSTRING_CONST, STATE_LSTRING_CONST_ESC, STATE_LSTRING_CONST_ESCHEX_0, STATE_LSTRING_CONST_ESCHEX_1, STATE_LSTRING_CONST_ESCHEX_2, STATE_LSTRING_CONST_ESCHEX_3, STATE_LSTRING_CONST_ESCOCT_1, STATE_LSTRING_CONST_ESCOCT_2, STATE_LSTRING_CONST_ESCOCT_3, STATE_LSTRING_CONST_ESCOCT_4, STATE_LSTRING_CONST_ESCOCT_5, STATE_LCHAR_CONST, STATE_LCHAR_CONST_ESC, STATE_LCHAR_CONST_ESCHEX_0, STATE_LCHAR_CONST_ESCHEX_1, STATE_LCHAR_CONST_ESCHEX_2, STATE_LCHAR_CONST_ESCHEX_3, STATE_LCHAR_CONST_ESCOCT_1, STATE_LCHAR_CONST_ESCOCT_2, STATE_LCHAR_CONST_ESCOCT_3, STATE_LCHAR_CONST_ESCOCT_4, STATE_LCHAR_CONST_ESCOCT_5, STATE_0, STATE_NUM_WHOLE, STATE_NUM_HEX, STATE_NUM_LEAD0_OCT, STATE_NUM_LEAD0, STATE_NUM_SUFF_L, STATE_NUM_SUFF_U, STATE_NUM_SUFF_LU, STATE_DOT, STATE_NUM_FRACT, STATE_FRACT_SUFF_E, STATE_FRACT_SUFF, STATE_FRACT_E_SIGN, STATE_FRACT_E_VAL, STATE_PREPROC, STATE_PREPROC_WORD, STATE_PREPROC_ESC, STATE_PREPROC_SLASH, STATE_COMMENT_PREPROC, STATE_COMMENT_STAR_PREPROC, STATE_COMMENT_DONE_PREPROC, STATE_PANIC }; /* This deserves a little explanation to say the least. This table is used to * compare identifiers against valid keywords and decide whether to color them * as keywords. Keywords are spelled out in columns of the array, and must be * in alphabetical order (by ASCII code -- so capital letters first. The * number, w, is the number of entries in the table, including this one, that * begin with the same sequence of letters. * * For example, since there are four C keywords that begin with the letter 'c', * kwtbl[0][2].w == 4. There are two keywords beginning 'con', and so * kwtbl[2][4].w == 2. */ #define N_KEYWORDS 32 typedef struct { unsigned char ch; unsigned char w; } kwtbl_ent; kwtbl_ent kwtbl[][N_KEYWORDS] = { { {'a',1}, {'b',1}, {'c',4}, {'c',3}, {'c',2}, {'c',1}, {'d',3}, {'d',2}, {'d',1}, {'e',3}, {'e',2}, {'e',1}, {'f',2}, {'f',1}, {'g',1}, {'i',2}, {'i',1}, {'l',1}, {'r',2}, {'r',1}, {'s',6}, {'s',5}, {'s',4}, {'s',3}, {'s',2}, {'s',1}, {'t',1}, {'u',2}, {'u',1}, {'v',2}, {'v',1}, {'w',1} }, { {'u',1}, {'r',1}, {'a',1}, {'h',1}, {'o',2}, {'o',1}, {'e',1}, {'o',2}, {'o',1}, {'l',1}, {'n',1}, {'x',1}, {'l',1}, {'o',1}, {'o',1}, {'f',1}, {'n',1}, {'o',1}, {'e',2}, {'e',1}, {'h',1}, {'i',2}, {'i',1}, {'t',2}, {'t',1}, {'w',1}, {'y',1}, {'n',2}, {'n',1}, {'o',2}, {'o',1}, {'h',1} }, { {'t',1}, {'e',1}, {'s',1}, {'a',1}, {'n',2}, {'n',1}, {'f',1}, {' ',0}, {'u',1}, {'s',1}, {'u',1}, {'t',1}, {'o',1}, {'r',1}, {'t',1}, {' ',0}, {'t',1}, {'n',1}, {'g',1}, {'t',1}, {'o',1}, {'g',1}, {'z',1}, {'a',1}, {'r',1}, {'i',1}, {'p',1}, {'i',1}, {'s',1}, {'i',1}, {'l',1}, {'i',1} }, { {'o',1}, {'a',1}, {'e',1}, {'r',1}, {'s',1}, {'t',1}, {'a',1}, {' ',0}, {'b',1}, {'e',1}, {'m',1}, {'e',1}, {'a',1}, {' ',0}, {'o',1}, {' ',0}, {' ',0}, {'g',1}, {'i',1}, {'u',1}, {'r',1}, {'n',1}, {'e',1}, {'t',1}, {'u',1}, {'t',1}, {'e',1}, {'o',1}, {'i',1}, {'d',1}, {'a',1}, {'l',1} }, { {' ',0}, {'k',1}, {' ',0}, {' ',0}, {'t',1}, {'i',1}, {'u',1}, {' ',0}, {'l',1}, {' ',0}, {' ',0}, {'r',1}, {'t',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'s',1}, {'r',1}, {'t',1}, {'e',1}, {'o',1}, {'i',1}, {'c',1}, {'c',1}, {'d',1}, {'n',1}, {'g',1}, {' ',0}, {'t',1}, {'e',1} }, { {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'n',1}, {'l',1}, {' ',0}, {'e',1}, {' ',0}, {' ',0}, {'n',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'t',1}, {'n',1}, {' ',0}, {'d',1}, {'f',1}, {'c',1}, {'t',1}, {'h',1}, {'e',1}, {' ',0}, {'n',1}, {' ',0}, {'i',1}, {' ',0} }, { {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'u',1}, {'t',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'e',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'f',1}, {' ',0}, {'e',1}, {' ',0}, {'l',1}, {' ',0} }, { {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'e',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'r',1}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {' ',0}, {'d',1}, {' ',0}, {'e',1}, {' ',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} } }; /* Modifies the values of kwpos and kwend with respect to the next character of * an identifier. kwpos points to the current position in the keyword table; * kwend to the first invalid position; n is the number of characters already * processed; and ch is the next character to process. The function will * update *kwpos and *kwend to take into account the new character. It will * set *kwpos to -1 if it determines that the word is not a keyword. */ static void check_kw(int *kwpos, int *kwend, int n, char ch) { int i; if (*kwpos == -1) return; while ((kwtbl[n][*kwpos].w == 0) && (*kwpos < *kwend)) (*kwpos)++; for (i = *kwpos; i < *kwend; i += kwtbl[n][i].w) if (ch == kwtbl[n][i].ch) break; if (i < *kwend) { *kwpos = i; *kwend = i + kwtbl[n][i].w; } else *kwpos = -1; } /* Utility function that does most of the work of the highlighter. It scans * the text using something resembling a DFA-based lexical scanner, except that * keywords are read from the table described above. The text to scan is * passed in txt, and pointers to variables containing a starting position and * starting state in idx and state. On return, idx and state are updated to * reflaect the next place to start scanning, and the return value is the * palette index to use when drawing the text. */ static int get_color(char *txt, int *idx, int *state) { int start_idx; int kwpos, kwend; kwpos = 0; kwend = N_KEYWORDS; start_idx = *idx; while (1) /* loop until we return a color */ { switch (*state) { case STATE_BEGIN1: if (txt[*idx] == '#') { (*idx)++; return COLOR_SYMBOL; } case STATE_BEGIN: if (isspace(txt[*idx])) { *state = STATE_WHITESPACE; (*idx)++; } /* A capital L is treated here as special because it can be the * introduction to a wide string or character constant and thus * not a word at all! */ else if (isalpha(txt[*idx]) || (txt[*idx] == '_')) { check_kw(&kwpos, &kwend, 0, txt[*idx]); if (txt[*idx] == 'L') *state = STATE_CAP_L; else *state = STATE_WORD; (*idx)++; } else switch (txt[*idx]) { case '0': *state = STATE_0; (*idx)++; break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': *state = STATE_NUM_WHOLE; (*idx)++; break; case '#': *state = STATE_PREPROC; (*idx)++; break; case '.': *state = STATE_DOT; (*idx)++; break; case '/': *state = STATE_SLASH; (*idx)++; break; case '\"': *state = STATE_STRING_CONST; (*idx)++; break; case '\'': *state = STATE_CHAR_CONST; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_IDENT; case '(': case '[': case '{': case '}': case ']': case ')': (*idx)++; if (txt[*idx] == '\0') *state = STATE_BEGIN; else *state = STATE_BEGIN1; return COLOR_BRACE; default: (*idx)++; if (txt[*idx] == '\0') *state = STATE_BEGIN; else *state = STATE_BEGIN1; return COLOR_SYMBOL; } break; case STATE_WHITESPACE: while (isspace(txt[*idx])) (*idx)++; if (txt[*idx] == '\0') { *state = STATE_BEGIN; return COLOR_IDENT; } else { *state = STATE_BEGIN1; return COLOR_IDENT; } case STATE_WORD: while (isalnum(txt[*idx]) || (txt[*idx] == '_')) { check_kw(&kwpos, &kwend, (*idx) - start_idx, txt[*idx]); (*idx)++; } if (txt[*idx] == '\0') *state = STATE_BEGIN; else *state = STATE_BEGIN1; if ((kwpos != -1) && (kwtbl[*idx - start_idx][kwpos].w == 0)) return COLOR_KEYWORD; else return COLOR_IDENT; case STATE_CAP_L: if (isalnum(txt[*idx]) || (txt[*idx] == '_')) { check_kw(&kwpos, &kwend, (*idx) - start_idx, txt[*idx]); *state = STATE_WORD; (*idx)++; } else switch (txt[*idx]) { case '\"': *state = STATE_LSTRING_CONST; (*idx)++; break; case '\'': *state = STATE_LCHAR_CONST; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_IDENT; default: *state = STATE_BEGIN1; return COLOR_IDENT; } break; case STATE_SLASH: switch (txt[*idx]) { case '*': *state = STATE_COMMENT; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_SYMBOL; default: *state = STATE_BEGIN1; return COLOR_SYMBOL; } break; case STATE_COMMENT: switch (txt[*idx]) { case '*': *state = STATE_COMMENT_STAR; (*idx)++; break; case '\0': return COLOR_COMMENT; default: (*idx)++; } break; case STATE_COMMENT_STAR: switch (txt[*idx]) { case '/': *state = STATE_COMMENT_DONE; (*idx)++; break; case '*': (*idx)++; break; case '\0': *state = STATE_COMMENT; return COLOR_COMMENT; default: *state = STATE_COMMENT; (*idx)++; } break; case STATE_COMMENT_DONE: if (txt[*idx] == '\0') { *state = STATE_BEGIN; return COLOR_COMMENT; } else { *state = STATE_BEGIN1; return COLOR_COMMENT; } case STATE_STRING_CONST: switch (txt[*idx]) { case '\"': (*idx)++; if (txt[*idx] == '\0') *state = STATE_BEGIN; else *state = STATE_BEGIN1; return COLOR_STRING; case '\\': *state = STATE_STRING_CONST_ESC; return COLOR_STRING; case '\0': return COLOR_STRING; default: (*idx)++; } break; case STATE_STRING_CONST_ESC: (*idx)++; switch (txt[*idx]) { case '\0': *state = STATE_STRING_CONST; return COLOR_STRINGE; case 'x': *state = STATE_STRING_CONST_ESCHEX_0; (*idx)++; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_STRING_CONST_ESCOCT_1; (*idx)++; break; case 'a': case 'b': case 'f': case 'n': case 'r': case 't': case 'v': case '\\': case '\'': case '\"': case '?': *state = STATE_STRING_CONST; (*idx)++; return COLOR_STRINGE; default: *state = STATE_STRING_CONST; (*idx)++; return COLOR_ILLEGAL; } break; case STATE_STRING_CONST_ESCHEX_0: if (isxdigit(txt[*idx])) { *state = STATE_STRING_CONST_ESCHEX_1; (*idx)++; } else { *state = STATE_STRING_CONST; return COLOR_ILLEGAL; } break; case STATE_STRING_CONST_ESCHEX_1: if (isxdigit(txt[*idx])) (*idx)++; *state = STATE_STRING_CONST; return COLOR_STRINGE; case STATE_STRING_CONST_ESCOCT_1: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_STRING_CONST_ESCOCT_2; (*idx)++; break; default: *state = STATE_STRING_CONST; return COLOR_STRINGE; } break; case STATE_STRING_CONST_ESCOCT_2: if ((txt[*idx] >= '0') && (txt[*idx] <= '7')) (*idx)++; *state = STATE_STRING_CONST; return COLOR_STRINGE; case STATE_CHAR_CONST: switch (txt[*idx]) { case '\'': (*idx)++; if (txt[*idx] == '\0') *state = STATE_BEGIN; else *state = STATE_BEGIN1; return COLOR_STRING; case '\\': *state = STATE_CHAR_CONST_ESC; return COLOR_STRING; case '\0': *state = STATE_BEGIN; return COLOR_STRING; default: (*idx)++; } break; case STATE_CHAR_CONST_ESC: (*idx)++; switch (txt[*idx]) { case '\0': *state = STATE_CHAR_CONST; return COLOR_STRINGE; case 'x': *state = STATE_CHAR_CONST_ESCHEX_0; (*idx)++; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_CHAR_CONST_ESCOCT_1; (*idx)++; break; case 'a': case 'b': case 'f': case 'n': case 'r': case 't': case 'v': case '\\': case '\'': case '\"': case '?': *state = STATE_CHAR_CONST; (*idx)++; return COLOR_STRINGE; default: *state = STATE_CHAR_CONST; (*idx)++; return COLOR_ILLEGAL; } break; case STATE_CHAR_CONST_ESCHEX_0: if (isxdigit(txt[*idx])) { *state = STATE_CHAR_CONST_ESCHEX_1; (*idx)++; } else { *state = STATE_CHAR_CONST; return COLOR_ILLEGAL; } break; case STATE_CHAR_CONST_ESCHEX_1: if (isxdigit(txt[*idx])) (*idx)++; *state = STATE_CHAR_CONST; return COLOR_STRINGE; case STATE_CHAR_CONST_ESCOCT_1: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_CHAR_CONST_ESCOCT_2; (*idx)++; break; default: *state = STATE_CHAR_CONST; return COLOR_STRINGE; } break; case STATE_CHAR_CONST_ESCOCT_2: if ((txt[*idx] >= '0') && (txt[*idx] <= '7')) (*idx)++; *state = STATE_CHAR_CONST; return COLOR_STRINGE; case STATE_LSTRING_CONST: switch (txt[*idx]) { case '\"': (*idx)++; if (txt[*idx] == '\0') *state = STATE_BEGIN; else *state = STATE_BEGIN1; return COLOR_STRING; case '\\': *state = STATE_LSTRING_CONST_ESC; return COLOR_STRING; case '\0': return COLOR_STRING; default: (*idx)++; } break; case STATE_LSTRING_CONST_ESC: (*idx)++; switch (txt[*idx]) { case '\0': *state = STATE_LSTRING_CONST; return COLOR_STRINGE; case 'x': *state = STATE_LSTRING_CONST_ESCHEX_0; (*idx)++; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_LSTRING_CONST_ESCOCT_1; (*idx)++; break; case 'a': case 'b': case 'f': case 'n': case 'r': case 't': case 'v': case '\\': case '\'': case '\"': case '?': *state = STATE_LSTRING_CONST; (*idx)++; return COLOR_STRINGE; default: *state = STATE_LSTRING_CONST; (*idx)++; return COLOR_ILLEGAL; } break; case STATE_LSTRING_CONST_ESCHEX_0: if (isxdigit(txt[*idx])) { *state = STATE_LSTRING_CONST_ESCHEX_1; (*idx)++; } else { *state = STATE_LSTRING_CONST; return COLOR_ILLEGAL; } break; case STATE_LSTRING_CONST_ESCHEX_1: if (isxdigit(txt[*idx])) { *state = STATE_LSTRING_CONST_ESCHEX_2; (*idx)++; } else { *state = STATE_LSTRING_CONST; return COLOR_STRINGE; } break; case STATE_LSTRING_CONST_ESCHEX_2: if (isxdigit(txt[*idx])) { *state = STATE_LSTRING_CONST_ESCHEX_3; (*idx)++; } else { *state = STATE_LSTRING_CONST; return COLOR_STRINGE; } break; case STATE_LSTRING_CONST_ESCHEX_3: if (isxdigit(txt[*idx])) (*idx)++; *state = STATE_LSTRING_CONST; return COLOR_STRINGE; case STATE_LSTRING_CONST_ESCOCT_1: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_LSTRING_CONST_ESCOCT_2; (*idx)++; break; default: *state = STATE_LSTRING_CONST; return COLOR_STRINGE; } break; case STATE_LSTRING_CONST_ESCOCT_2: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_LSTRING_CONST_ESCOCT_3; (*idx)++; break; default: *state = STATE_LSTRING_CONST; return COLOR_STRINGE; } break; case STATE_LSTRING_CONST_ESCOCT_3: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_LSTRING_CONST_ESCOCT_4; (*idx)++; break; default: *state = STATE_LSTRING_CONST; return COLOR_STRINGE; } break; case STATE_LSTRING_CONST_ESCOCT_4: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_LSTRING_CONST_ESCOCT_5; (*idx)++; break; default: *state = STATE_LSTRING_CONST; return COLOR_STRINGE; } break; case STATE_LSTRING_CONST_ESCOCT_5: if ((txt[*idx] >= '0') && (txt[*idx] <= '7')) (*idx)++; *state = STATE_LSTRING_CONST; return COLOR_STRINGE; case STATE_LCHAR_CONST: switch (txt[*idx]) { case '\'': (*idx)++; if (txt[*idx] == '\0') *state = STATE_BEGIN; else *state = STATE_BEGIN1; return COLOR_STRING; case '\\': *state = STATE_LCHAR_CONST_ESC; return COLOR_STRING; case '\0': *state = STATE_BEGIN; return COLOR_STRING; default: (*idx)++; } break; case STATE_LCHAR_CONST_ESC: (*idx)++; switch (txt[*idx]) { case '\0': *state = STATE_LCHAR_CONST; return COLOR_STRINGE; case 'x': *state = STATE_LCHAR_CONST_ESCHEX_0; (*idx)++; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_LCHAR_CONST_ESCOCT_1; (*idx)++; break; case 'a': case 'b': case 'f': case 'n': case 'r': case 't': case 'v': case '\\': case '\'': case '\"': case '?': *state = STATE_LCHAR_CONST; (*idx)++; return COLOR_STRINGE; default: *state = STATE_LCHAR_CONST; (*idx)++; return COLOR_ILLEGAL; } break; case STATE_LCHAR_CONST_ESCHEX_0: if (isxdigit(txt[*idx])) { *state = STATE_LCHAR_CONST_ESCHEX_1; (*idx)++; } else { *state = STATE_LCHAR_CONST; return COLOR_ILLEGAL; } break; case STATE_LCHAR_CONST_ESCHEX_1: if (isxdigit(txt[*idx])) { *state = STATE_LCHAR_CONST_ESCHEX_2; (*idx)++; } else { *state = STATE_LCHAR_CONST; return COLOR_STRINGE; } break; case STATE_LCHAR_CONST_ESCHEX_2: if (isxdigit(txt[*idx])) { *state = STATE_LCHAR_CONST_ESCHEX_3; (*idx)++; } else { *state = STATE_LCHAR_CONST; return COLOR_STRINGE; } break; case STATE_LCHAR_CONST_ESCHEX_3: if (isxdigit(txt[*idx])) (*idx)++; *state = STATE_LCHAR_CONST; return COLOR_STRINGE; case STATE_LCHAR_CONST_ESCOCT_1: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_LCHAR_CONST_ESCOCT_2; (*idx)++; break; default: *state = STATE_LCHAR_CONST; return COLOR_STRINGE; } break; case STATE_LCHAR_CONST_ESCOCT_2: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_LCHAR_CONST_ESCOCT_3; (*idx)++; break; default: *state = STATE_LCHAR_CONST; return COLOR_STRINGE; } break; case STATE_LCHAR_CONST_ESCOCT_3: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_LCHAR_CONST_ESCOCT_4; (*idx)++; break; default: *state = STATE_LCHAR_CONST; return COLOR_STRINGE; } break; case STATE_LCHAR_CONST_ESCOCT_4: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_LCHAR_CONST_ESCOCT_5; (*idx)++; break; default: *state = STATE_LCHAR_CONST; return COLOR_STRINGE; } break; case STATE_LCHAR_CONST_ESCOCT_5: if ((txt[*idx] >= '0') && (txt[*idx] <= '7')) (*idx)++; *state = STATE_LCHAR_CONST; return COLOR_STRINGE; case STATE_0: switch (txt[*idx]) { case 'x': case 'X': *state = STATE_NUM_HEX; (*idx)++; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *state = STATE_NUM_LEAD0_OCT; (*idx)++; break; case '8': case '9': *state = STATE_NUM_LEAD0; (*idx)++; break; case '.': *state = STATE_NUM_FRACT; (*idx)++; break; case 'L': case 'l': *state = STATE_NUM_SUFF_L; (*idx)++; break; case 'U': case 'u': *state = STATE_NUM_SUFF_U; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalpha(txt[*idx]) || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN1; return COLOR_NUMBER; } } break; case STATE_NUM_HEX: if (isxdigit(txt[*idx])) { (*idx)++; } else switch (txt[*idx]) { case 'L': case 'l': *state = STATE_NUM_SUFF_L; (*idx)++; break; case 'U': case 'u': *state = STATE_NUM_SUFF_U; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalpha(txt[*idx]) || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN1; return COLOR_NUMBER; } } break; case STATE_NUM_WHOLE: while (isdigit(txt[*idx])) (*idx)++; switch (txt[*idx]) { case '.': *state = STATE_NUM_FRACT; (*idx)++; break; case 'L': case 'l': *state = STATE_NUM_SUFF_L; (*idx)++; break; case 'U': case 'u': *state = STATE_NUM_SUFF_U; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalpha(txt[*idx]) || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN1; return COLOR_NUMBER; } } break; case STATE_PREPROC: while (isspace(txt[*idx])) (*idx)++; if (isalpha(txt[*idx]) || (txt[*idx] == '_')) { *state = STATE_PREPROC_WORD; (*idx)++; } else switch (txt[*idx]) { case '/': *state = STATE_PREPROC_SLASH; return COLOR_PREPROC; case '\\': *state = STATE_PREPROC_ESC; return COLOR_PREPROC; case '\0': *state = STATE_BEGIN; return COLOR_PREPROC; default: *state = STATE_BEGIN1; return COLOR_PREPROC; } break; case STATE_DOT: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': *state = STATE_NUM_FRACT; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_SYMBOL; default: *state = STATE_BEGIN1; return COLOR_SYMBOL; } break; case STATE_NUM_LEAD0_OCT: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': (*idx)++; break; case '8': case '9': *state = STATE_NUM_LEAD0; (*idx)++; break; case '.': *state = STATE_NUM_FRACT; (*idx)++; break; case 'L': case 'l': *state = STATE_NUM_SUFF_L; (*idx)++; break; case 'U': case 'u': *state = STATE_NUM_SUFF_U; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalpha(txt[*idx]) || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN1; return COLOR_NUMBER; } } break; case STATE_NUM_LEAD0: switch (txt[*idx]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': (*idx)++; break; case '.': *state = STATE_NUM_FRACT; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_ILLEGAL; default: *state = STATE_PANIC; } break; case STATE_NUM_FRACT: while (isdigit(txt[*idx])) (*idx)++; switch (txt[*idx]) { case 'E': case 'e': *state = STATE_FRACT_SUFF_E; (*idx)++; break; case 'F': case 'f': case 'L': case 'l': *state = STATE_FRACT_SUFF; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalpha(txt[*idx]) || (txt[*idx] == '_') || (txt[*idx] == '.')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN1; return COLOR_NUMBER; } } break; case STATE_NUM_SUFF_L: switch (txt[*idx]) { case 'U': case 'u': *state = STATE_NUM_SUFF_LU; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalnum(txt[*idx]) || (txt[*idx] == '.') || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN1; return COLOR_NUMBER; } } break; case STATE_NUM_SUFF_U: switch (txt[*idx]) { case 'L': case 'l': *state = STATE_NUM_SUFF_LU; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalnum(txt[*idx]) || (txt[*idx] == '.') || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN1; return COLOR_NUMBER; } } break; case STATE_NUM_SUFF_LU: switch (txt[*idx]) { case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalnum(txt[*idx]) || (txt[*idx] == '.') || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN1; return COLOR_NUMBER; } } break; case STATE_FRACT_SUFF_E: if (isdigit(txt[*idx])) { *state = STATE_FRACT_E_VAL; (*idx)++; } else if (isalpha(txt[*idx]) || (txt[*idx] == '.') || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else switch (txt[*idx]) { case '+': case '-': *state = STATE_FRACT_E_SIGN; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_ILLEGAL; default: *state = STATE_BEGIN1; return COLOR_ILLEGAL; } break; case STATE_FRACT_E_SIGN: if (isdigit(txt[*idx])) { *state = STATE_FRACT_E_VAL; (*idx)++; } else if (isalpha(txt[*idx]) || (txt[*idx] == '.') || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else switch (txt[*idx]) { case '\0': *state = STATE_BEGIN; return COLOR_ILLEGAL; default: *state = STATE_BEGIN1; return COLOR_ILLEGAL; } break; case STATE_FRACT_E_VAL: while (isdigit(txt[*idx])) (*idx)++; switch (txt[*idx]) { case 'F': case 'f': case 'L': case 'l': *state = STATE_FRACT_SUFF; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_NUMBER; default: if (isalpha(txt[*idx]) || (txt[*idx] == '.') || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else { *state = STATE_BEGIN1; return COLOR_NUMBER; } } break; case STATE_FRACT_SUFF: if (isalnum(txt[*idx]) || (txt[*idx] == '.') || (txt[*idx] == '_')) { *state = STATE_PANIC; (*idx)++; } else if (txt[*idx] == '\0') { *state = STATE_BEGIN; return COLOR_NUMBER; } else { *state = STATE_BEGIN1; return COLOR_NUMBER; } break; case STATE_PREPROC_WORD: while (isalnum(txt[*idx]) || (txt[*idx] == '_')) (*idx)++; if (txt[*idx] == '\0') { *state = STATE_BEGIN; return COLOR_PREPROC; } else { *state = STATE_BEGIN1; return COLOR_PREPROC; } case STATE_PREPROC_ESC: (*idx)++; if (txt[*idx] == '\0') { *state = STATE_PREPROC; return COLOR_PREPROC; } else { *state = STATE_BEGIN1; return COLOR_SYMBOL; } case STATE_PREPROC_SLASH: (*idx)++; switch (txt[*idx]) { case '*': *state = STATE_COMMENT_PREPROC; (*idx)++; break; case '\0': *state = STATE_BEGIN; return COLOR_SYMBOL; default: *state = STATE_BEGIN1; return COLOR_SYMBOL; } break; case STATE_COMMENT_PREPROC: switch (txt[*idx]) { case '*': *state = STATE_COMMENT_STAR_PREPROC; (*idx)++; break; case '\0': return COLOR_COMMENT; default: (*idx)++; } break; case STATE_COMMENT_STAR_PREPROC: switch (txt[*idx]) { case '/': *state = STATE_COMMENT_DONE_PREPROC; (*idx)++; break; case '*': (*idx)++; break; case '\0': *state = STATE_COMMENT_PREPROC; return COLOR_COMMENT; default: *state = STATE_COMMENT_PREPROC; (*idx)++; } break; case STATE_COMMENT_DONE_PREPROC: switch (txt[*idx]) { case '\0': *state = STATE_BEGIN; return COLOR_COMMENT; default: *state = STATE_PREPROC; return COLOR_COMMENT; } case STATE_PANIC: while (isalnum(txt[*idx]) || (txt[*idx] == '_')) (*idx)++; if (txt[*idx] == '\0') { *state = STATE_BEGIN; return COLOR_ILLEGAL; } else { *state = STATE_BEGIN1; return COLOR_ILLEGAL; } default: while (txt[*idx] != '\0') (*idx)++; return COLOR_DEBUG; } } return COLOR_IDENT; } /* The exported syntax highlighter function. This function itself really only * exists to take care of a few loose ends. In fact, these loose ends are * common to all languages, so this code should probably be moved to screen.c * instead of put here. But that's not possible now because the perl and SGML * modules act differently. As soon as I get all this stuff working the same, * I'll move stuff around to avoid duplicating code. */ int mode_highlight(buffer *buf, buf_line *ln, int lnum, int *idx, int *state) { if (*state == -1) { int i, pos; char *c; while (buf->state_valid_num < lnum) { c = buf->state_valid->txt; pos = 0; *state = buf->state_valid->start_state; do get_color(c, &pos, state); while (c[pos] != '\0'); buf->state_valid = buf->state_valid->next; buf->state_valid_num++; buf->state_valid->start_state = *state; } c = ln->txt; i = 0; *state = ln->start_state; while (i < *idx) get_color(c, &i, state); } return get_color(ln->txt, idx, state); } lpe-1.2.7/src/modes/lispmode.c0000644000175000017500000001420407314070337015104 0ustar adammadamm/* lispmode.c * * Copyright (c) Chris Smith * * Author: * Gergely Nagy * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #include #include #include #include "lpecomm.h" #include "highlight.h" #include "mode-utils.h" enum _states { STATE_BEGIN = 0, STATE_TAG, STATE_QUOTE, STATE_COMMENT, STATE_SYMBOL, STATE_COMMAND_BEGIN, STATE_COMMAND_END, STATE_COMMAND }; #define COLOR_TEXT 70 #define COLOR_COMMAND 71 int mode_accept(buffer *buf) { char *suffix; suffix = strrchr(buf->name, '.'); /* * FIXME: This list is probably incomplete. The only lisp I * know is guile and rep (.scm,.jl,.rep), others are probably * missing. */ if (suffix != NULL && mode_util_accept_extensions ( suffix, 0, 4, ".jl", ".rep", ".scm", ".el" )) return 1; /* * FIXME: other 'modes' should be added if one findes them */ return mode_util_accept_on_request ( buf->text->txt, 0, 2, "lisp", "scheme", "emacs-lisp" ); } void mode_init(buffer *buf) { if (buf->mode_name == NULL) { buf->hardtab = mode_util_get_option_with_default ( "lispmode", "hardtab", 0 ); buf->autoindent = mode_util_get_option_with_default ( "lispmode", "autoindent", 1 ); buf->offerhelp = mode_util_get_option_with_default ( "lispmode", "offerhelp", 1 ); buf->highlight = mode_util_get_option_with_default ( "lispmode", "highlight", 1 ); buf->flashbrace = mode_util_get_option_with_default ( "lispmode", "flashbrace", 1 ); } buf->mode_name = "lispmode"; buf->state_valid = buf->text; buf->state_valid_num = 0; buf->text->start_state = STATE_BEGIN; } void mode_enter(buffer *buf) { mode_util_set_slang_color ( "lispmode", "text", COLOR_TEXT, "lightgray", "black" ); mode_util_set_slang_color ( "lispmode", "comment", COLOR_COMMENT, COLOR_COMMENT_FG, COLOR_COMMENT_BG ); mode_util_set_slang_color ( "lispmode", "symbol", COLOR_SYMBOL, COLOR_SYMBOL_FG, COLOR_SYMBOL_BG ); mode_util_set_slang_color ( "lispmode", "brace", COLOR_BRACE, COLOR_BRACE_FG, COLOR_BRACE_BG ); mode_util_set_slang_color ( "lispmode", "command", COLOR_COMMAND, "cyan", "black" ); mode_util_set_slang_color ( "lispmode", "string", COLOR_STRING, COLOR_STRING_FG, COLOR_STRING_BG ); } /* LISP implementation of brace flashing * * Rules: * 1. Braces are () and they must be properly nested * 2. Ignore anything inside quotation marks (double only) * 3. Disregard rule 2 if the quote is escaped * 4. Ignore anything after a ';' (lisp comment) * 5. Print a silent warning in the minibuf for known mismatched braces */ /* * FIXME: brace mismatch detection does not work. don't know why... */ int mode_flashbrace(buffer *buf) { char *brace_stack; int sp; char ch, quote; if (buf->pos.col == 0) return 0; ch = buf->pos.line->txt[buf->pos.col - 1]; if (ch != ')') return 0; if ( (strchr(buf->pos.line->txt, ';')) && (buf->pos.col > strchr(buf->pos.line->txt, ';') - buf->pos.line->txt) ) return 0; brace_stack = (char *)malloc ( 1024 ); brace_stack[0] = ch; sp = 1; buf->pos.col--; quote = '\0'; do { char last_ch; while (buf->pos.col <= 0) { if (buf->pos.line == buf->scrollpos) { free ( brace_stack ); return 0; } buf->pos.line = buf->pos.line->prev; buf->linenum--; buf->pos.col = strlen(buf->pos.line->txt); if ( strchr(buf->pos.line->txt, ';') ) buf->pos.col = strchr(buf->pos.line->txt, ';') - buf->pos.line->txt; } buf->pos.col--; last_ch = ch; ch = buf->pos.line->txt[buf->pos.col]; if (quote != '\0') { if (ch == quote) quote = '\0'; else if ((last_ch == quote) && (ch == '\\')) quote = 0; continue; } switch (ch) { case ')': if (sp == sizeof ( brace_stack ) ) brace_stack = (char *) realloc ( brace_stack, sizeof ( brace_stack ) + 1024 ); brace_stack[sp++] = ch; break; case '(': if (brace_stack[--sp] != ')') { free ( brace_stack ); return -1; } break; case '\"': quote = ch; break; case '\\': if ((last_ch == '\'') || (last_ch == '\"')) quote = last_ch; break; } } while (sp != 0); free ( brace_stack ); set_scr_col(buf); return 1; } #define STATE (*state & 0x00ff) #define EXCL (*state & 0xff00) int mode_highlight(buffer *buf, buf_line *ln, int lnum, int *idx, int *state) { int color; int i, ch; if (*state == -1) { *state = buf->state_valid->start_state; while (buf->state_valid_num < lnum) { i = 0; while (buf->state_valid->txt[i]) mode_highlight(buf, buf->state_valid, buf->state_valid_num, &i, state); buf->state_valid = buf->state_valid->next; buf->state_valid_num++; buf->state_valid->start_state = *state; } i = 0; color = -1; *state = ln->start_state; while (i < *idx) color = mode_highlight(buf, ln, lnum, &i, state); if ((i > *idx) && (color != -1)) { *idx = i; return color; } } ch = ln->txt[*idx]; if (ch == 0) return COLOR_TEXT; if (STATE == STATE_SYMBOL) { if (isalnum(ch) || strchr("_-", ch)) { (*idx)++; return COLOR_SYMBOL; } else *state = STATE_TAG | EXCL; } if (STATE == STATE_COMMAND_BEGIN || STATE == STATE_COMMAND || STATE == STATE_COMMAND_END ) { if (isalnum(ch) || strchr("_-?!*", ch)) { (*idx)++; *state = STATE_COMMAND_END | EXCL; return COLOR_COMMAND; } else { if ( !isspace(ch) || STATE == STATE_COMMAND_END ) *state = STATE_TAG | EXCL; else *state = STATE_COMMAND | EXCL; } } if (ln->txt[*idx] == ';') { *idx = strlen(ln->txt); return COLOR_COMMENT; } if (strchr("'", ch)) { (*idx)++; *state = STATE_SYMBOL | EXCL; return COLOR_SYMBOL; } if (strchr("()", ch)) { (*idx)++; if ( ch == '(' ) *state = STATE_COMMAND_BEGIN | EXCL; else *state = STATE_TAG | EXCL; return COLOR_BRACE; } if (ch == '"') { (*idx)++; *state = STATE_QUOTE | EXCL; } if (STATE == STATE_QUOTE) { while ((ln->txt[*idx]) && (ln->txt[*idx] != '"')) (*idx)++; if (ln->txt[*idx] == '"') { (*idx)++; *state = STATE_TAG | EXCL; } return COLOR_STRING; } (*idx)++; return COLOR_TEXT; } lpe-1.2.7/src/modes/htmlmode.c0000644000175000017500000001667107743362671015126 0ustar adammadamm/* htmlmode.c * * Copyright (c) 1999 Chris Smith * * Author: * Eckehard Berns * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #include #include #include "lpecomm.h" #include "highlight.h" #include "mode-utils.h" enum _states { STATE_BEGIN = 0, STATE_TAG, STATE_ARGUMENT, STATE_QUOTE, STATE_VALUE, STATE_COMMENT, STATE_SSI }; #define COLOR_TEXT 70 #define COLOR_TAG 71 #define COLOR_SPECIAL 72 #define COLOR_ARGUMENT 73 #define COLOR_VALUE 74 #define COLOR_SSI 75 static int is_ssi = 0; int mode_accept(buffer *buf) { char *suffix; suffix = strrchr(buf->name, '.'); if (suffix == NULL) return 0; return mode_util_accept_extensions ( suffix, 0, 5, ".html", ".htm", ".shtml", ".dhtml", ".gtml" ); } void mode_init(buffer *buf) { if (buf->mode_name == NULL) { buf->hardtab = mode_util_get_option_with_default ( "htmlmode", "hardtab", 1 ); buf->autoindent = mode_util_get_option_with_default ( "htmlmode", "autoindent", 0 ); buf->offerhelp = mode_util_get_option_with_default ( "htmlmode", "offerhelp", 1 ); buf->highlight = mode_util_get_option_with_default ( "htmlmode", "highlight", 1 ); buf->flashbrace = mode_util_get_option_with_default ( "htmlmode", "flashbrace", 1 ); } buf->mode_name = "htmlmode"; buf->state_valid = buf->text; buf->state_valid_num = 0; buf->text->start_state = STATE_BEGIN; } void mode_enter(buffer *buf) { mode_util_set_slang_color("htmlmode", "text", COLOR_TEXT, "lightgray", "black" ); mode_util_set_slang_color("htmlmode", "tag", COLOR_TAG, "cyan", "black" ); mode_util_set_slang_color("htmlmode", "comment", COLOR_COMMENT, COLOR_COMMENT_FG, COLOR_COMMENT_BG ); mode_util_set_slang_color("htmlmode", "argument", COLOR_ARGUMENT, "blue", "black" ); mode_util_set_slang_color("htmlmode", "special", COLOR_SPECIAL, "brown", "black" ); mode_util_set_slang_color("htmlmode", "value", COLOR_VALUE, "brightblue", "black" ); mode_util_set_slang_color("htmlmode", "ssi", COLOR_SSI, "magenta", "black" ); mode_util_set_slang_color("htmlmode", "symbol", COLOR_SYMBOL, COLOR_SYMBOL_FG, COLOR_SYMBOL_BG ); mode_util_set_slang_color("htmlmode", "brace", COLOR_BRACE, COLOR_BRACE_FG, COLOR_BRACE_BG ); mode_util_set_slang_color("htmlmode", "illegal", COLOR_ILLEGAL, COLOR_ILLEGAL_FG, COLOR_ILLEGAL_BG ); } /* SGML implementation of brace flashing * * Rules: * 1. Braces are <>, and they cannot be nested * 2. Ignore anything inside quotation marks (double) */ int mode_flashbrace(buffer * buf) { int found; char ch, quote; if (buf->pos.col == 0) return 0; ch = buf->pos.line->txt[buf->pos.col - 1]; if (ch != '>') return 0; buf->pos.col--; quote = '\0'; found = 0; do { while (buf->pos.col <= 0) { if (buf->pos.line == buf->scrollpos) return 0; buf->pos.line = buf->pos.line->prev; buf->linenum--; buf->pos.col = strlen(buf->pos.line->txt); } buf->pos.col--; ch = buf->pos.line->txt[buf->pos.col]; if (quote != '\0') { if (ch == quote) quote = '\0'; continue; } switch (ch) { case '<': found = 1; break; case '\"': quote = ch; break; } } while (!found); set_scr_col(buf); return 1; } #define IS_NAME(a) ((isalnum(a) || ((a) == '_') || \ ((a) == '%') || ((a) == '&') || \ ((a) == '.') || ((a) == '#'))) #define IS_WHITE(a) (isspace(a)) #define STATE (*state & 0x00ff) #define EXCL (*state & 0xff00) int mode_highlight(buffer * buf, buf_line * ln, int lnum, int *idx, int *state) { int color; int i, ch; char *p; if (*state == -1) { *state = buf->state_valid->start_state; while (buf->state_valid_num < lnum) { i = 0; while (buf->state_valid->txt[i]) mode_highlight(buf, buf->state_valid, buf->state_valid_num, &i, state); buf->state_valid = buf->state_valid->next; buf->state_valid_num++; buf->state_valid->start_state = *state; } i = 0; color = -1; *state = ln->start_state; while (i < *idx) color = mode_highlight(buf, ln, lnum, &i, state); if ((i > *idx) && (color != -1)) { *idx = i; return color; } } ch = ln->txt[*idx]; if (ch == 0) return COLOR_TEXT; if (ch == '>') { (*idx)++; if (STATE == STATE_BEGIN) return COLOR_ILLEGAL; *state = STATE_BEGIN | EXCL; return COLOR_TAG; } if ((*state == (STATE_TAG | 0x100)) && (ch == '-') && (ln->txt[*idx + 1] == '-') && (ln->txt[*idx + 2] == '#')) { *state = STATE_SSI | EXCL; (*idx) += 3; is_ssi = 1; } if ((*state == (STATE_TAG | 0x100)) && (ch == '-') && (ln->txt[*idx + 1] == '-')) { *state = STATE_COMMENT | EXCL; (*idx) += 2; } if ((STATE == STATE_TAG) && (IS_WHITE(ch))) { do { (*idx)++; } while (IS_WHITE(ln->txt[*idx])); return COLOR_TAG; } if (((STATE == STATE_TAG) || (STATE == STATE_ARGUMENT)) && (strchr("-;|+*?,", ch))) { (*idx)++; *state = STATE_TAG | EXCL; return COLOR_SYMBOL; } if (((STATE == STATE_TAG) || (STATE == STATE_ARGUMENT)) && (strchr("()[]", ch))) { (*idx)++; *state = STATE_TAG | EXCL; return COLOR_BRACE; } if ((STATE == STATE_TAG) && (IS_NAME(ch))) { do { (*idx)++; } while (IS_NAME(ln->txt[*idx])); *state = STATE_ARGUMENT | EXCL; return COLOR_ARGUMENT; } if ((STATE == STATE_TAG) && (ch == '"')) { (*idx)++; *state = STATE_QUOTE | EXCL; } if (STATE == STATE_TAG) { (*idx)++; return COLOR_ILLEGAL; } if ((STATE == STATE_ARGUMENT) && (ch == '=')) { (*idx)++; if (ln->txt[*idx] == '"') { *state = STATE_TAG | EXCL; } else { *state = STATE_VALUE | EXCL; } return COLOR_TAG; } if (STATE == STATE_ARGUMENT) { if (IS_WHITE(ch)) { (*idx)++; *state = STATE_TAG | EXCL; return COLOR_TAG; } (*idx)++; return COLOR_ILLEGAL; } if (STATE == STATE_VALUE) { while ((!IS_WHITE(ln->txt[*idx])) && (ln->txt[*idx]) && (ln->txt[*idx] != '>')) (*idx)++; *state = STATE_TAG | EXCL; return COLOR_VALUE; } if (STATE == STATE_QUOTE) { while ((ln->txt[*idx]) && (ln->txt[*idx] != '"')) (*idx)++; if (ln->txt[*idx] == '"') { (*idx)++; *state = STATE_TAG | EXCL; } return COLOR_VALUE; } if ((STATE == STATE_COMMENT) || (STATE == STATE_SSI)) { p = strstr(&(ln->txt[*idx]), "--"); if (p == NULL) { *idx = strlen(ln->txt); } else { *state = STATE_TAG | EXCL; *idx = p + 2 - ln->txt; } if (is_ssi) { is_ssi = 0; return COLOR_SSI; } else return COLOR_COMMENT; } if (ch == '<') { *state = STATE_TAG; (*idx)++; if (ln->txt[*idx] == '!') { *state = STATE_TAG | 0x100; (*idx)++; } else if (ln->txt[*idx] == '/') { (*idx)++; } ch = ln->txt[*idx]; while (IS_NAME(ch)) { (*idx)++; ch = ln->txt[*idx]; } return COLOR_TAG; } if (ch == '&') { do { (*idx)++; ch = ln->txt[*idx]; } while ((IS_NAME(ch)) || (ch == '#')); if (ch == ';') { (*idx)++; return COLOR_SPECIAL; } return COLOR_ILLEGAL; } *idx += strcspn(&(ln->txt[*idx]), "<&"); return COLOR_TEXT; } lpe-1.2.7/src/modes/mailmode.c0000644000175000017500000001041410327515776015067 0ustar adammadamm/* mailmode.c * * Copyright (c) 1999 Chris Smith * * Author: * Eckehard Berns * Mod by: * Michal Safranek * Brief description of my patch: * - accepts any files starting with 'From ' text * - it colorizes any header (detected by occurence 'From ') in the file * (needs to be rewritten - really ugly) * - any changes are commented by p-w string * Mod #2 by: * Gergely Nagy * - turned flashbrace off * - tried to fix header highlighting. It works for me :) * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #include #include #include "lpecomm.h" #include "highlight.h" #include "mode-utils.h" enum _state { STATE_BEGIN = 0, STATE_HEADER, STATE_BODY, STATE_SIG }; #define COLOR_TEXT 0 #define COLOR_TEXT_FG "lightgray" #define COLOR_TEXT_BG "black" #define COLOR_HEADER 1 #define COLOR_HEADER_FG "green" #define COLOR_HEADER_BG "black" #define COLOR_QUOTE 2 #define COLOR_QUOTE_FG "cyan" #define COLOR_QUOTE_BG "black" #define COLOR_QUOTE2 3 #define COLOR_QUOTE2_FG "brightblue" #define COLOR_QUOTE2_BG "black" #define COLOR_SIG 4 #define COLOR_SIG_FG "red" #define COLOR_SIG_BG "black" int mode_accept(buffer *buf) { if (strncmp(buf->name, "mutt-", 5) == 0) return 1; if ((strncmp(buf->name, "pico.", 5) == 0) && (atoi(buf->name + 5))) return 1; if ((strncmp(buf->text->txt, "From ", 5) == 0)) { return 1; } return 0; } void mode_init(buffer *buf) { if (buf->mode_name == NULL) { buf->hardtab = mode_util_get_option_with_default ( "mailmode", "hardtab", 1 ); buf->autoindent = mode_util_get_option_with_default ( "mailmode", "autoindent", 0 ); buf->offerhelp = mode_util_get_option_with_default ( "mailmode", "offerhelp", 1 ); buf->highlight = mode_util_get_option_with_default ( "mailmode", "highlight", 1 ); buf->flashbrace = mode_util_get_option_with_default ( "mailmode", "flashbrace", 0 ); } buf->mode_name = "mailmode"; buf->state_valid = buf->text; buf->state_valid_num = 0; buf->text->start_state = 0; } void mode_enter(buffer *buf) { SLtt_set_color(COLOR_TEXT, NULL, COLOR_TEXT_FG, COLOR_TEXT_BG); SLtt_set_color(COLOR_HEADER, NULL, COLOR_HEADER_FG, COLOR_HEADER_BG); SLtt_set_color(COLOR_QUOTE, NULL, COLOR_QUOTE_FG, COLOR_QUOTE_BG); SLtt_set_color(COLOR_QUOTE2, NULL, COLOR_QUOTE2_FG, COLOR_QUOTE2_BG); SLtt_set_color(COLOR_SIG, NULL, COLOR_SIG_FG, COLOR_SIG_BG); } int mode_highlight(buffer * buf, buf_line * ln, int lnum, int *idx, int *state) { int quote, i; char *p; if (*state == -1) { *state = buf->state_valid->start_state; while (buf->state_valid_num < lnum) { i = 0; mode_highlight(buf, buf->state_valid, buf->state_valid_num, &i, state); buf->state_valid = buf->state_valid->next; buf->state_valid_num++; buf->state_valid->start_state = *state; } *state = ln->start_state; } if (*state == STATE_BEGIN) *state = STATE_HEADER; if(strncmp(ln->txt, "From ", 5)==0) *state=STATE_HEADER;/* p-w */ if (ln->txt[*idx] == 0 /**/&& *state!=STATE_SIG/**/) {/* p-w */ *state = STATE_BODY; return COLOR_TEXT; } if (*idx > 0) { *idx = strlen(ln->txt); return COLOR_TEXT; } *idx = strlen(ln->txt); if (*state == STATE_SIG) return COLOR_SIG; if (/*(lnum == 0) && */(0 == strncmp("From ", ln->txt, 5))){/* p-w */ *state=STATE_HEADER;/* p-w */ return COLOR_HEADER; } /* * This did not work for me * - Gergely Nagy */ /* if (*state == STATE_HEADER) { if (0 != (i = strcspn(ln->txt, ": "))) { if (ln->txt[i] == ':') return COLOR_HEADER; } if ( 0 != strncmp("\n", ln->txt, 1)) *state = STATE_BODY; } */ if ( *state == STATE_HEADER ) { return COLOR_HEADER; } if (0 == strncmp("--", ln->txt, 2)) { p = ln->txt + 2; while ((*p == ' ') || (*p == '\t')) p++; if (*p == 0) { *state = STATE_SIG; return COLOR_SIG; } } quote = 0; p = ln->txt; if (*p != ' ') { while ((strchr(" >:|", *p)) && (*p)) { if (*p != ' ') quote++; p++; } if (quote) return (quote % 2)?COLOR_QUOTE:COLOR_QUOTE2; } return COLOR_TEXT; } lpe-1.2.7/src/modes/sgmlmode.c0000644000175000017500000001745107136076626015117 0ustar adammadamm/* sgmlmode.c * * Copyright (c) 1999 Chris Smith * * Author: * Eckehard Berns * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #include #include #include "lpecomm.h" #include "highlight.h" #include "mode-utils.h" enum _states { STATE_BEGIN = 0, STATE_TAG, STATE_ARGUMENT, STATE_QUOTE, STATE_VALUE, STATE_COMMENT, STATE_SLASH }; #define COLOR_TEXT 70 #define COLOR_TAG 71 #define COLOR_SPECIAL 72 #define COLOR_ARGUMENT 73 #define COLOR_VALUE 74 #define COLOR_SLASH_TEXT 75 int mode_accept(buffer *buf) { char *suffix; suffix = strrchr(buf->name, '.'); if (suffix == NULL) return 0; return mode_util_accept_extensions ( suffix, 0, 3, ".sgml", ".sgm", ".dtd" ); } void mode_init(buffer *buf) { if (buf->mode_name == NULL) { buf->hardtab = mode_util_get_option_with_default ( "sgmlmode", "hardtab", 1 ); buf->autoindent = mode_util_get_option_with_default ( "sgmlmode", "autoindent", 0 ); buf->offerhelp = mode_util_get_option_with_default ( "sgmlmode", "offerhelp", 1 ); buf->highlight = mode_util_get_option_with_default ( "sgmlmode", "highlight", 1 ); buf->flashbrace = mode_util_get_option_with_default ( "sgmlmode", "flashbrace", 1 ); } buf->mode_name = "sgmlmode"; buf->state_valid = buf->text; buf->state_valid_num = 0; buf->text->start_state = STATE_BEGIN; } void mode_enter(buffer *buf) { mode_util_set_slang_color("sgmlmode", "text", COLOR_TEXT, "lightgray", "black" ); mode_util_set_slang_color("sgmlmode", "tag", COLOR_TAG, "cyan", "black" ); mode_util_set_slang_color("sgmlmode", "comment", COLOR_COMMENT, COLOR_COMMENT_FG, COLOR_COMMENT_BG ); mode_util_set_slang_color("sgmlmode", "argument", COLOR_ARGUMENT, "blue", "black" ); mode_util_set_slang_color("sgmlmode", "special", COLOR_SPECIAL, "brown", "black" ); mode_util_set_slang_color("sgmlmode", "value", COLOR_VALUE, "brightblue", "black" ); mode_util_set_slang_color("sgmlmode", "slash_text", COLOR_SLASH_TEXT, "magneta", "black" ); mode_util_set_slang_color("sgmlmode", "symbol", COLOR_SYMBOL, COLOR_SYMBOL_FG, COLOR_SYMBOL_BG ); mode_util_set_slang_color("sgmlmode", "brace", COLOR_BRACE, COLOR_BRACE_FG, COLOR_BRACE_BG ); mode_util_set_slang_color("sgmlmode", "illegal", COLOR_ILLEGAL, COLOR_ILLEGAL_FG, COLOR_ILLEGAL_BG ); } /* SGML implementation of brace flashing * * Rules: * 1. Braces are <>, and they cannot be nested * 2. Ignore anything inside quotation marks (double) * 3. In SGML mode also use pos.col == 0) return 0; ch = buf->pos.line->txt[buf->pos.col - 1]; if ((ch != '>') && (ch != '/')) return 0; found_slash = (ch == '/') ? 0 : 2; buf->pos.col--; quote = '\0'; found = 0; do { while (buf->pos.col <= 0) { if (buf->pos.line == buf->scrollpos) return 0; buf->pos.line = buf->pos.line->prev; buf->linenum--; buf->pos.col = strlen(buf->pos.line->txt); } buf->pos.col--; ch = buf->pos.line->txt[buf->pos.col]; if (quote != '\0') { if (ch == quote) quote = '\0'; continue; } switch (ch) { case '/': if (found_slash != 2) { if (found_slash) return 0; found_slash = 1; } break; case '<': found = 1; break; case '\"': quote = ch; break; } } while (!found); set_scr_col(buf); return 1; } #define IS_NAME(a) (isalnum(a) || ((a) == '_') || \ ((a) == '%') || ((a) == '&') || \ ((a) == '.') || ((a) == '#')) #define IS_WHITE(a) (isspace(a)) #define STATE (*state & 0x00ff) #define EXCL (*state & 0xff00) int mode_highlight(buffer * buf, buf_line * ln, int lnum, int *idx, int *state) { int color; int i, ch; char *p; if (*state == -1) { *state = buf->state_valid->start_state; while (buf->state_valid_num < lnum) { i = 0; while (buf->state_valid->txt[i]) mode_highlight(buf, buf->state_valid, buf->state_valid_num, &i, state); buf->state_valid = buf->state_valid->next; buf->state_valid_num++; buf->state_valid->start_state = *state; } i = 0; color = -1; *state = ln->start_state; while (i < *idx) color = mode_highlight(buf, ln, lnum, &i, state); if ((i > *idx) && (color != -1)) { *idx = i; return color; } } ch = ln->txt[*idx]; if (ch == 0) return COLOR_TEXT; if (ch == '>') { (*idx)++; if (STATE == STATE_BEGIN) return COLOR_ILLEGAL; *state = STATE_BEGIN | EXCL; return COLOR_TAG; } if ((*state == (STATE_TAG | 0x100)) && (ch == '-') && (ln->txt[*idx + 1] == '-')) { *state = STATE_COMMENT | EXCL; (*idx) += 2; } if ((STATE == STATE_TAG) && (IS_WHITE(ch))) { do { (*idx)++; } while (IS_WHITE(ln->txt[*idx])); return COLOR_TAG; } if (((STATE == STATE_TAG) || (STATE == STATE_ARGUMENT)) && (strchr("-;|+*?,", ch))) { (*idx)++; *state = STATE_TAG | EXCL; return COLOR_SYMBOL; } if (((STATE == STATE_TAG) || (STATE == STATE_ARGUMENT)) && (strchr("()[]", ch))) { (*idx)++; *state = STATE_TAG | EXCL; return COLOR_BRACE; } if ((STATE == STATE_TAG) && (IS_NAME(ch))) { do { (*idx)++; } while (IS_NAME(ln->txt[*idx])); *state = STATE_ARGUMENT | EXCL; return COLOR_ARGUMENT; } if ((STATE == STATE_TAG) && (ch == '"')) { (*idx)++; *state = STATE_QUOTE | EXCL; } if ((STATE == STATE_TAG) && (ch == '/')) { (*idx)++; *state = STATE_SLASH | EXCL; return COLOR_TAG; } if (STATE == STATE_TAG) { (*idx)++; return COLOR_ILLEGAL; } if ((STATE == STATE_ARGUMENT) && (ch == '=')) { (*idx)++; if (ln->txt[*idx] == '"') { *state = STATE_TAG | EXCL; } else { *state = STATE_VALUE | EXCL; } return COLOR_TAG; } if (STATE == STATE_ARGUMENT) { if (IS_WHITE(ch)) { (*idx)++; *state = STATE_TAG | EXCL; return COLOR_TAG; } (*idx)++; return COLOR_ILLEGAL; } if (STATE == STATE_VALUE) { while ((!IS_WHITE(ln->txt[*idx])) && (ln->txt[*idx]) && (ln->txt[*idx] != '>')) (*idx)++; *state = STATE_TAG | EXCL; return COLOR_VALUE; } if (STATE == STATE_QUOTE) { while ((ln->txt[*idx]) && (ln->txt[*idx] != '"')) (*idx)++; if (ln->txt[*idx] == '"') { (*idx)++; *state = STATE_TAG | EXCL; } return COLOR_VALUE; } if (STATE == STATE_COMMENT) { p = strstr(&(ln->txt[*idx]), "--"); if (p == NULL) { *idx = strlen(ln->txt); } else { *state = STATE_TAG | EXCL; *idx = p + 2 - ln->txt; } return COLOR_COMMENT; } if (*state == STATE_SLASH) { if (ch == '/') { (*idx)++; *state = STATE_BEGIN; return COLOR_TAG; } p = strchr(&(ln->txt[*idx]), '/'); if (p == NULL) p = &(ln->txt[strlen(ln->txt)]); color = COLOR_SLASH_TEXT; *idx = p - ln->txt; return color; } if (ch == '<') { *state = STATE_TAG; (*idx)++; if (ln->txt[*idx] == '!') { *state = STATE_TAG | 0x100; (*idx)++; } else if (ln->txt[*idx] == '/') { (*idx)++; } ch = ln->txt[*idx]; while (IS_NAME(ch)) { (*idx)++; ch = ln->txt[*idx]; } if (ch == '/') { *state = STATE_SLASH; (*idx)++; } return COLOR_TAG; } if (ch == '&') { do { (*idx)++; ch = ln->txt[*idx]; } while ((IS_NAME(ch)) || (ch == '#')); if (ch == ';') { (*idx)++; return COLOR_SPECIAL; } return COLOR_ILLEGAL; } *idx += strcspn(&(ln->txt[*idx]), "<&"); return COLOR_TEXT; } lpe-1.2.7/src/lpecomm.h0000644000175000017500000000744310100535431013615 0ustar adammadamm/* lpecomm.h * * Copyright (c) 1999 Chris Smith * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #ifndef LPE_LPECOMM_H #define LPE_LPECOMM_H #include "options.h" #include #include SLANG_H /* forward decls */ struct _buffer; struct _buf_line; /* A mode for a buffer. Modes are used to define behaviors that are specific * to particular programming languages or situations. Modes consist of * function pointers, which can point to code to do a specific task, or can be * NULL to indicate that a task should not be performed. * * init: initializes the buffer according to conventions of the mode */ typedef struct _buf_mode { void *handle; void *data; void (*init)(struct _buffer *); void (*uninit)(struct _buffer *); void (*enter)(struct _buffer *); void (*leave)(struct _buffer *); void (*extkey)(struct _buffer *, int ch); int (*flashbrace)(struct _buffer *); int (*highlight)(struct _buffer *, struct _buf_line *, int, int *, int *); int (*indent)(struct _buffer *, char ch); } buf_mode; /* A line in the file, represented as a doubly linked list node. * * txt_len: length of allocated space for the line's text * txt: pointer to a string representing the text of this line * next: pointer to the next line * prev: pointer to the previous line */ typedef struct _buf_line { unsigned int txt_len; char *txt; struct _buf_line *next; struct _buf_line *prev; unsigned int start_state; } buf_line; /* A position in the buffer * * line: a pointer to the line node for the position * col: a numerical index into the text of that line */ typedef struct _buf_pos { buf_line *line; int col; } buf_pos; /* The buffer itself, with all relevant info * * text: the head of the linked list of lines * scrollpos: pointer to the first visible line on the screen * scrollnum: line number of the first visible line * scrollcol: column number (on the screen) of the first visible column * pos: the current cursor position in the text of the buffer * scr_col: the cursor column on the screen itself * linenum: the line number of the current line * preferred_col: the index on the screen of the "preferred" column * fname: full filename of the file being edited * name: short name (aka, basename) of the file being edited * rdonly: flag indicating if the buffer is read-only * modified: flag indicating if the buffer has been modified since last saved * hardtab: flag indicating whether to insert tabs or simulate them w/ spaces * mode: in case of dynamic modes, the active buffer mode */ typedef struct _buffer { buf_line *text; buf_line *scrollpos; int scrollnum; int scrollcol; buf_pos pos; int scr_col; int linenum; int preferred_col; char *fname, *name; int fname_valid; int rdonly; int modified; char *mode_name; buf_mode mode; buf_line *state_valid; int state_valid_num; int hardtab; int autoindent; int offerhelp; int highlight; int flashbrace; int usecrlf; int break_hard_links; /* 1 if save will break hard links. 0 is default */ struct _buffer *next; struct _buffer *prev; } buffer; /* A macro to calculate the length of the line referred to by a buf_pos. This * is just a little more efficient for long lines, since it takes into account * that the line is known to be at least as long as the current column. */ #define LINELEN(pos) (strlen((pos).line->txt + pos.col) + pos.col) int is_control(char c); int next_mult(int now, int spacing); int check_scrolling(buffer *buf); void check_col(buffer *buf); void set_scr_col(buffer *buf); int add_char(int c, buffer *buf); void del_char(buffer *buf); void def_indent(buffer *buf, char ch); #endif /* LPE_LPECOMM_H */ lpe-1.2.7/src/exports.c0000644000175000017500000000425607314070226013670 0ustar adammadamm/* exports.c * * Copyright (c) 2000 Chris Smith * * Author: * Gergely Nagy * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #include #include "cfg-core.h" #include "cfg.h" #include "lpecomm.h" #include "buffer.h" #include "screen.h" #include "mode-utils.h" #include #include SLANG_H static int i_lpe_exists (char *filename) { if (access (filename, R_OK) == 0) return 1; else return 0; } static void i_lpe_reset (void) { buffer *buff; buff = the_buf; if (buff->mode.leave) (*buff->mode.leave) (buff); if (buff->mode.enter) (*buff->mode.enter) (buff); if (buff->mode_name) mode_util_set_options (buff, buff->mode_name, buff->hardtab || 0, buff->autoindent || 1, buff->offerhelp || 1, buff->highlight || 0, buff->flashbrace || 0); refresh_complete = 1; } static void i_cfg_core_set_any (void) { int rtype; char *string; char *name; int i; SLpop_string (&name); SLang_pop_integer (&rtype); switch (rtype) { case 1: case 2: SLang_pop_integer (&i); cfg_core_set_any (name, rtype, i); break; case 0: SLpop_string (&string); cfg_core_set_any (name, rtype, string); break; } } static SLang_Intrin_Fun_Type Exports[] = { MAKE_INTRINSIC_1 ("lpe_exists", i_lpe_exists, SLANG_INT_TYPE, SLANG_STRING_TYPE), MAKE_INTRINSIC_0 ("lpe_cfg_reset", i_lpe_reset, SLANG_VOID_TYPE), MAKE_INTRINSIC_0 ("lpe_cfg_core_set_any", i_cfg_core_set_any, SLANG_VOID_TYPE), MAKE_INTRINSIC_1 ("_lpe_cfg_core_get_str", cfg_core_get_str, SLANG_STRING_TYPE, SLANG_STRING_TYPE), SLANG_END_TABLE }; void export_all (void) { SLang_init_all (); SLadd_intrin_fun_table (Exports, NULL); SLang_load_string ("define lpe_set_option ( option, value )" "{" " if ( _typeof ( value ) == String_Type )" " {" " lpe_cfg_core_set_any ( value, 0, option );" " }" " else" " {" " lpe_cfg_core_set_any ( value, 1, option );" " }" "}"); } lpe-1.2.7/src/screen.c0000644000175000017500000003743210327516125013446 0ustar adammadamm/* screen.c * * Copyright (c) 1999 Chris Smith * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #include "options.h" #include #include #include #include #include #include #include SLANG_H #include #include #include "lpe.h" #include "lpecomm.h" #include "screen.h" #include "buffer.h" #include "minibuf.h" #include "input.h" #include "help.h" #include "cfg.h" /* Definitions of screen update flags. See screen.h for explanation. */ volatile sig_atomic_t refresh_complete; volatile sig_atomic_t refresh_text; volatile sig_atomic_t refresh_banner; /* A global variable used to determine the starting column for the minibuf... * this is in turn returned by get_minibuf_col, which is used in minibuf.c to * decide when to start scrolling the minibuf for mbuf_ask(). */ int minibuf_col = 0; /* Initialize the S-Lang libraries for use in lpe. This sets up the screen and * does other various cleanup needed for screen management. */ void init_slang (void) { SLtt_get_terminfo (); #ifdef TIOCGWINSZ { struct winsize ws; /* Try to get a better screen size. However, some terminals * (Microsoft * Windows bundled telnet client, for example) will * report 0x0 as the * size, so check for that first. */ if (!ioctl (1, TIOCGWINSZ, &ws) && (ws.ws_row != 0) && (ws.ws_col != 0)) { SLtt_Screen_Rows = ws.ws_row; SLtt_Screen_Cols = ws.ws_col; } } #endif /* defined(TIOCGWINSZ) */ SLang_init_tty (-1, 1, 0); SLang_set_abort_signal (NULL); SLsmg_init_smg (); refresh_text = 1; refresh_banner = 1; refresh_complete = 0; } /* Initialize key bindings for S-Lang. This is separated because it need not * be done again when the screen is completely refreshed. In fact, binding * these keys several times seems to result in some type of memory leak, so it * is really important that this only gets called once. */ void init_slang_keys (void) { char *term, *bp; SLkp_init (); /* dumb hacks to fix some terminal weirdness */ term = getenv ("TERM"); bp = 0; if( tgetent( bp, term ) == 1 ){ if( key_backspace ) SLkp_define_keysym (key_backspace, LPE_BACKSPACE_KEY); else SLkp_define_keysym ("\010", LPE_BACKSPACE_KEY); if( delete_character ) SLkp_define_keysym (delete_character, LPE_DELETE_KEY); else SLkp_define_keysym ("\177", LPE_DELETE_KEY); /* FIXME */ SLkp_define_keysym ("\030", LPE_EXIT_KEY); /* Ctrl-X */ SLkp_define_keysym ("\032", LPE_SUSPEND_KEY); /* Ctrl-Z */ SLkp_define_keysym ("\014", LPE_REFRESH_KEY); /* Ctrl-L */ SLkp_define_keysym ("\022", LPE_PGUP_KEY); /* Ctrl-R */ SLkp_define_keysym ("\024", LPE_PGDN_KEY); /* Ctrl-T */ SLkp_define_keysym ("\017", LPE_PREV_WORD_KEY); /* Ctrl-O */ SLkp_define_keysym ("\020", LPE_NEXT_WORD_KEY); /* Ctrl-P */ SLkp_define_keysym ("\013", LPE_KILL_KEY); /* Ctrl-K */ SLkp_define_keysym ("\025", LPE_YANK_KEY); /* Ctrl-U */ SLkp_define_keysym ("\031", LPE_YANK_KEY); /* Ctrl-Y */ SLkp_define_keysym ("\023", LPE_SEARCH_KEY); /* Ctrl-S */ SLkp_define_keysym ("\001", LPE_FIND_NEXT_KEY); /* Ctrl-A */ SLkp_define_keysym ("\006\017", LPE_OPEN_KEY); /* Ctrl-F Ctrl-O */ SLkp_define_keysym ("\006\023", LPE_SAVE_KEY); /* Ctrl-F Ctrl-S */ SLkp_define_keysym ("\006\001", LPE_SAVE_ALT_KEY); /* Ctrl-F Ctrl-A */ SLkp_define_keysym ("\006\022", LPE_READF_KEY); /* Ctrl-F Ctrl-R */ SLkp_define_keysym ("\006\005", LPE_CLEARMOD_KEY); /* Ctrl-F Ctrl-E */ SLkp_define_keysym ("\006\030", LPE_NEXTBUF_KEY); /* Ctrl-F Ctrl-X */ SLkp_define_keysym ("\006\032", LPE_PREVBUF_KEY); /* Ctrl-F Ctrl-Z */ SLkp_define_keysym ("\006\016", LPE_OPENBUF_KEY); /* Ctrl-F Ctrl-N */ SLkp_define_keysym ("\006\014", LPE_CLOSEBUF_KEY); /* Ctrl-F Ctrl-L */ SLkp_define_keysym ("\002\023", LPE_SET_MODE_KEY); /* Ctrl-B Ctrl-S */ SLkp_define_keysym ("\002\024", LPE_TAB_SWAP_KEY); /* Ctrl-B Ctrl-T */ SLkp_define_keysym ("\002\001", LPE_AI_TOGGLE_KEY); /* Ctrl-B Ctrl-A */ SLkp_define_keysym ("\007\021", LPE_HOME_KEY); /* Ctrl-G Ctrl-Q */ SLkp_define_keysym ("\007\027", LPE_END_KEY); /* Ctrl-G Ctrl-W */ SLkp_define_keysym ("\007\001", LPE_BUF_START_KEY); /* Ctrl-G Ctrl-A */ SLkp_define_keysym ("\007\023", LPE_BUF_END_KEY); /* Ctrl-G Ctrl-S */ SLkp_define_keysym ("\007\007", LPE_GOTOLN_KEY); /* Ctrl-G Ctrl-G */ SLkp_define_keysym ("\016\022", LPE_REP_KEY); /* Ctrl-N Ctrl-R */ SLkp_define_keysym ("\016\024", LPE_REP_QUAD_KEY); /* Ctrl-N Ctrl-T */ SLkp_define_keysym ("\016\017", LPE_RECORDER_KEY); /* Ctrl-N Ctrl-O */ SLkp_define_keysym ("\016\020", LPE_PLAYBACK_KEY); /* Ctrl-N Ctrl-P */ SLkp_define_keysym ("\026\026", LPE_SHELL_KEY); /* Ctrl-V Ctrl-V */ SLkp_define_keysym ("\026\001", LPE_AWK_KEY); /* Ctrl-V Ctrl-A */ SLkp_define_keysym ("\026\023", LPE_SED_KEY); /* Ctrl-V Ctrl-S */ SLkp_define_keysym ("\026\002", LPE_SHELL_LN_KEY); /* Ctrl-V Ctrl-B */ SLkp_define_keysym ("\026\004", LPE_AWK_LN_KEY); /* Ctrl-V Ctrl-D */ SLkp_define_keysym ("\026\006", LPE_SED_LN_KEY); /* Ctrl-V Ctrl-F */ SLkp_define_keysym ("\005", LPE_HELP_KEY); /* Ctrl-E */ SLkp_define_keysym ("\004\004", LPE_DEBUG_KEY); /* Ctrl-D Ctrl-D */ SLkp_define_keysym ("\004\023", LPE_SLANG_KEY); /* Ctrl-D Ctrl-S */ } else if (!strcmp (term, "mach") || !strcmp (term, "mach-color")) { fprintf(stderr, "Tell me if you see this! \n"); SLkp_define_keysym ("\177", LPE_BACKSPACE_KEY); } else { /* No terminfo - guess backspace and delete keys */ fprintf(stderr, "No terminfo record found... File a bug against your terminal..."); SLkp_define_keysym ("\010", LPE_BACKSPACE_KEY); SLkp_define_keysym ("\177", LPE_DELETE_KEY); SLkp_define_keysym ("\030", LPE_EXIT_KEY); /* Ctrl-X */ SLkp_define_keysym ("\032", LPE_SUSPEND_KEY); /* Ctrl-Z */ SLkp_define_keysym ("\014", LPE_REFRESH_KEY); /* Ctrl-L */ SLkp_define_keysym ("\022", LPE_PGUP_KEY); /* Ctrl-R */ SLkp_define_keysym ("\024", LPE_PGDN_KEY); /* Ctrl-T */ SLkp_define_keysym ("\017", LPE_PREV_WORD_KEY); /* Ctrl-O */ SLkp_define_keysym ("\020", LPE_NEXT_WORD_KEY); /* Ctrl-P */ SLkp_define_keysym ("\013", LPE_KILL_KEY); /* Ctrl-K */ SLkp_define_keysym ("\025", LPE_YANK_KEY); /* Ctrl-U */ SLkp_define_keysym ("\031", LPE_YANK_KEY); /* Ctrl-Y */ SLkp_define_keysym ("\023", LPE_SEARCH_KEY); /* Ctrl-S */ SLkp_define_keysym ("\001", LPE_FIND_NEXT_KEY); /* Ctrl-A */ SLkp_define_keysym ("\006\017", LPE_OPEN_KEY); /* Ctrl-F Ctrl-O */ SLkp_define_keysym ("\006\023", LPE_SAVE_KEY); /* Ctrl-F Ctrl-S */ SLkp_define_keysym ("\006\001", LPE_SAVE_ALT_KEY); /* Ctrl-F Ctrl-A */ SLkp_define_keysym ("\006\022", LPE_READF_KEY); /* Ctrl-F Ctrl-R */ SLkp_define_keysym ("\006\005", LPE_CLEARMOD_KEY); /* Ctrl-F Ctrl-E */ SLkp_define_keysym ("\006\030", LPE_NEXTBUF_KEY); /* Ctrl-F Ctrl-X */ SLkp_define_keysym ("\006\032", LPE_PREVBUF_KEY); /* Ctrl-F Ctrl-Z */ SLkp_define_keysym ("\006\016", LPE_OPENBUF_KEY); /* Ctrl-F Ctrl-N */ SLkp_define_keysym ("\006\014", LPE_CLOSEBUF_KEY); /* Ctrl-F Ctrl-L */ SLkp_define_keysym ("\002\023", LPE_SET_MODE_KEY); /* Ctrl-B Ctrl-S */ SLkp_define_keysym ("\002\024", LPE_TAB_SWAP_KEY); /* Ctrl-B Ctrl-T */ SLkp_define_keysym ("\002\001", LPE_AI_TOGGLE_KEY); /* Ctrl-B Ctrl-A */ SLkp_define_keysym ("\007\021", LPE_HOME_KEY); /* Ctrl-G Ctrl-Q */ SLkp_define_keysym ("\007\027", LPE_END_KEY); /* Ctrl-G Ctrl-W */ SLkp_define_keysym ("\007\001", LPE_BUF_START_KEY); /* Ctrl-G Ctrl-A */ SLkp_define_keysym ("\007\023", LPE_BUF_END_KEY); /* Ctrl-G Ctrl-S */ SLkp_define_keysym ("\007\007", LPE_GOTOLN_KEY); /* Ctrl-G Ctrl-G */ SLkp_define_keysym ("\016\022", LPE_REP_KEY); /* Ctrl-N Ctrl-R */ SLkp_define_keysym ("\016\024", LPE_REP_QUAD_KEY); /* Ctrl-N Ctrl-T */ SLkp_define_keysym ("\016\017", LPE_RECORDER_KEY); /* Ctrl-N Ctrl-O */ SLkp_define_keysym ("\016\020", LPE_PLAYBACK_KEY); /* Ctrl-N Ctrl-P */ SLkp_define_keysym ("\026\026", LPE_SHELL_KEY); /* Ctrl-V Ctrl-V */ SLkp_define_keysym ("\026\001", LPE_AWK_KEY); /* Ctrl-V Ctrl-A */ SLkp_define_keysym ("\026\023", LPE_SED_KEY); /* Ctrl-V Ctrl-S */ SLkp_define_keysym ("\026\002", LPE_SHELL_LN_KEY); /* Ctrl-V Ctrl-B */ SLkp_define_keysym ("\026\004", LPE_AWK_LN_KEY); /* Ctrl-V Ctrl-D */ SLkp_define_keysym ("\026\006", LPE_SED_LN_KEY); /* Ctrl-V Ctrl-F */ SLkp_define_keysym ("\005", LPE_HELP_KEY); /* Ctrl-E */ SLkp_define_keysym ("\004\004", LPE_DEBUG_KEY); /* Ctrl-D Ctrl-D */ SLkp_define_keysym ("\004\023", LPE_SLANG_KEY); /* Ctrl-D Ctrl-S */ } } /* Get out of S-Lang's raw terminal mode */ void cleanup_slang (void) { SLsmg_gotorc (SLtt_Screen_Rows - 1, 0); SLsmg_refresh (); SLsmg_reset_smg (); SLang_reset_tty (); } /* Draw the banner at the bottom of the screen */ static void draw_banner (buffer * buf) { char banner[1024]; char tmp[20], *ptmp; int pos, t; if (SLtt_Use_Ansi_Colors) SLsmg_set_color (0); memset (banner, '-', SLtt_Screen_Cols); memcpy (banner + 2, "lpe", 3); if (buf->rdonly) banner[7] = '%'; if (buf->modified) banner[7] = '*'; pos = 10; if (buf->offerhelp && !is_help) { ptmp = _("Ctrl-E for Help"); t = strlen (ptmp); memcpy (banner + pos, ptmp, t); pos += t + 2; } t = strlen (buf->name); memcpy (banner + pos, buf->name, t); pos += t + 2; if (buf->mode_name != NULL) { t = strlen (buf->mode_name); memcpy (banner + pos, "<", 1); memcpy (banner + pos + 1, buf->mode_name, t); memcpy (banner + pos + t + 1, ">", 1); pos += t + 4; } sprintf (tmp, "L%u", buf->linenum + 1); t = strlen (tmp); memcpy (banner + pos, tmp, t); pos += t + 2; if (public_repeat_count > 1) { sprintf (tmp, "(%u)", public_repeat_count); t = strlen (tmp); memcpy (banner + pos, tmp, t); pos += t + 2; } minibuf_col = pos; if (the_mbuf.vis) { int i = 0; t = strlen (the_mbuf.label); memcpy (banner + pos, the_mbuf.label, t); pos += t; t = strlen (the_mbuf.text + the_mbuf.scroll); if (t > the_mbuf.width) t = the_mbuf.width; else if (t < the_mbuf.width) i = the_mbuf.width - t; memcpy (banner + pos, the_mbuf.text + the_mbuf.scroll, t); pos += t; while (i > 0) { banner[pos++] = ' '; i--; } } SLsmg_gotorc (SLtt_Screen_Rows - 1, 0); SLsmg_write_nchars (banner, SLtt_Screen_Cols); } /* Move the cursor to the place it should be on the screen. This should be * called between any drawing activity and a refresh, because drawing changes * the cursor position. */ static void position_cursor (buffer * buf) { if (the_mbuf.focus) { SLsmg_gotorc (SLtt_Screen_Rows - 1, minibuf_col + strlen (the_mbuf.label) + the_mbuf.pos - the_mbuf.scroll); } else { SLsmg_gotorc (buf->linenum - buf->scrollnum, buf->scr_col - buf->scrollcol); } } /* Writes a representation for this control character into the buffer to print, * but backwards so as to coincide with my nifty little write_seg's strange * behavior. */ static void control_rep (char c, char *rep) { unsigned char ch = c; rep[2] = '\0'; if (ch < 32) { rep[1] = '^'; rep[0] = '@' + ch; } else if (ch == '\177') { rep[1] = '^'; rep[0] = '?'; } else if ((ch > 127) && (ch < 160)) { rep[1] = '~'; rep[0] = '@' + (ch - 128); } else { /* this shouldn't be happening -- so I print something obviously * * wrong so that people will notice if it does! :) */ rep[1] = '^'; rep[0] = '!'; } } /* Write a segment of text to the screen, starting at start_col within the * line, and writing at most width characters. Also takes into account tabs * in the line. */ static int write_seg (char *txt, int chars, int max_col, int start_col, int vis_col) { /* This is ugly, but at least it works */ char *p = txt; char *pending; int npending; int col = start_col; int htw = cfg_get_global_int_with_default ("hard_tab_width", DEF_HARD_TAB_WIDTH); // int htw= DEF_HARD_TAB_WIDTH; char c; npending = 0; pending = (char *) malloc (htw + 1); while (((p - txt) < chars) || (npending > 0)) { if (npending > 0) { c = pending[--npending]; } else if (*p == '\t') { int i, tab_spcs; tab_spcs = htw - (col - ((col / htw) * htw)) - 1; for (i = 0; i < tab_spcs; i++) pending[i] = ' '; npending = i; c = ' '; p++; } else if (is_control (*p)) { control_rep (*p, pending); c = pending[1]; npending = 1; p++; } else { c = *p; p++; } if ((col >= vis_col) && (col < max_col)) SLsmg_write_char (c); col++; } free (pending); return col; } static void write_line (buffer * buf, buf_line * line, int lnum, int vis_col) { char *txt; int i = 0; txt = line->txt; if ((SLtt_Use_Ansi_Colors) && (buf->highlight) && (buf->mode.highlight != NULL)) { int idx, start, state, len; idx = 0; state = -1; i = 0; len = strlen (txt); do { int color; start = idx; color = (*buf->mode.highlight) (buf, line, lnum, &idx, &state); SLsmg_set_color (color); i = write_seg (txt + start, idx - start, SLtt_Screen_Cols + vis_col - 1, i, vis_col); } while (idx < len); if (line->next != NULL) { line->next->start_state = state; buf->state_valid = line->next; buf->state_valid_num = lnum + 1; } /* back to a normal color for extra space and/or $ */ SLsmg_set_color (0); } else { int txtlen; txtlen = strlen (txt); i = write_seg (txt, txtlen, SLtt_Screen_Cols + vis_col - 1, 0, vis_col); } if (i - vis_col >= SLtt_Screen_Cols) { SLsmg_write_char ('$'); } else while (i - vis_col < SLtt_Screen_Cols) { if (i >= vis_col) SLsmg_write_char (' '); i++; } } /* Draw the current screenful of text to the screen */ static void draw_text (buffer * buf) { int i; buf_line *curline; curline = buf->scrollpos; for (i = 0; (i < SLtt_Screen_Rows - 1) && (curline != NULL); i++) { SLsmg_gotorc (i, 0); write_line (buf, curline, buf->scrollnum + i, buf->scrollcol); curline = curline->next; } while (i < SLtt_Screen_Rows - 1) { SLsmg_gotorc (i, 0); SLsmg_write_nstring (cfg_get_global_string_with_default ("eof_fill", DEF_EOF_FILL), SLtt_Screen_Cols); i++; } } /* Completely refresh the screen, re-initializing S-Lang and everything. Used * in case something gets screwed up, or when (as with Ctrl-Z) the editor gets * suspended and then resumed, and needs to be restored. */ static void refresh_screen (buffer * buf) { SLsmg_reset_smg (); SLang_reset_tty (); init_slang (); draw_text (buf); draw_banner (buf); position_cursor (buf); SLsmg_refresh (); } void draw_screen (buffer * buf) { if (refresh_complete) { refresh_screen (buf); refresh_complete = 0; refresh_text = 0; refresh_banner = 0; return; } if (refresh_text || refresh_banner) { if (refresh_text) { draw_text (buf); refresh_text = 0; } if (refresh_banner) { draw_banner (buf); refresh_banner = 0; } } position_cursor (buf); SLsmg_refresh (); } int get_minibuf_col (void) { return minibuf_col; } lpe-1.2.7/src/mode-utils.c0000644000175000017500000000641307314070307014243 0ustar adammadamm/* mode-utils.c * * Copyright (c) 1999 Chris Smith * * Author: * Gergely Nagy * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #include #include "mode-utils.h" #include "strfuncs.h" #include #include #include #ifdef HAVE_STRING_H #include #endif #include SLANG_H static int _mode_util_accept_one (char *line, char *mode); int mode_util_accept_extensions (char *extension, int case_sensitive, int cnt, ...) { va_list el; char *ext; int i; va_start (el, cnt); for (i = 0; i < cnt; i++) { ext = va_arg (el, char *); if (case_sensitive) { if (!strcmp (extension, ext)) { va_end (el); return 1; } } else { if (!g_strcasecmp (extension, ext)) { va_end (el); return 1; } } } va_end (el); return 0; } int mode_util_accept_on_request (char *line, int case_sensitive, int cnt, ...) { va_list modelist; char *c_mode; char *cs_line; int i; if (!line || (line && strlen (line) == 0)) return 0; cs_line = g_strdup (line); if (!case_sensitive) g_strdown (cs_line); va_start (modelist, cnt); for (i = 0; i < cnt; i++) { c_mode = va_arg (modelist, char *); if (_mode_util_accept_one (cs_line, c_mode)) { free (cs_line); va_end (modelist); return 1; } } va_end (modelist); free (cs_line); return 0; } void mode_util_set_slang_color (char *mode, char *color_id, int sl_color_id, char *def_fg, char *def_bg) { char *fg, *bg; fg = cfg_get_option_string_with_default (mode, "color", color_id, def_fg); bg = cfg_get_option_string_with_default (mode, "background", color_id, def_bg); if (fg && !strcmp (fg, "transparent")) fg = NULL; if (bg && !strcmp (bg, "transparent")) bg = NULL; SLtt_set_color (sl_color_id, NULL, fg, bg); } void mode_util_set_options (buffer * buf, char *mode, int hardtab, int autoindent, int offerhelp, int highlight, int flashbrace) { buf->hardtab = mode_util_get_option_with_default (mode, "hardtab", hardtab); buf->autoindent = mode_util_get_option_with_default (mode, "autoindent", autoindent); buf->offerhelp = mode_util_get_option_with_default (mode, "offerhelp", offerhelp); buf->highlight = mode_util_get_option_with_default (mode, "highlight", highlight); buf->flashbrace = mode_util_get_option_with_default (mode, "flashbrace", flashbrace); } static int _mode_util_accept_one (char *line, char *mode) { char *substring; char *tmp = NULL; if ((tmp = strstr (line, "-*-")) == NULL) return 0; substring = g_strdup (tmp + 3); if (!substring) return 0; if (!strstr(substring, "-*-")) return 0; substring[strlen (substring) - strlen (strstr (substring, "-*-"))] = '\0'; if ((tmp = strstr (substring, mode)) != NULL) { /* * Check if it's not a false alarm... * If the chare before mode is one of ":;- " AND * the one after it is one of ";- ", then we've * found it. */ tmp--; if (strchr (": ;-", tmp[0]) && strchr ("; -", tmp[strlen (mode) + 1])) { free (substring); return 1; } } free (substring); return 0; } lpe-1.2.7/src/strfuncs.h0000644000175000017500000000113507135305054014032 0ustar adammadamm/* strfuncs.c * * Copyright (c) 1999 Chris Smith * * Author: * The GLib team, copied from glib 1.2.6 sourcetree * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #ifndef LPE_STRFUNCS_H #define LPE_STRFUNCS_H int g_strcasecmp ( const char *s1, const char *s2 ); int g_strncasecmp ( const char *s1, const char *s2, unsigned int n ); void g_strdown ( char *string ); void g_strup ( char *string ); char *g_strdup ( const char *string ); char *g_strndup ( const char *string, unsigned int n ); #endif /* ! LPE_STRFUNCS_H */ lpe-1.2.7/src/screen.h0000644000175000017500000000171106737463317013460 0ustar adammadamm/* screen.h * * Copyright (c) 1999 Chris Smith * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #ifndef LPE_SCREEN_H #define LPE_SCREEN_H #include #include "buffer.h" /* Flags indicating pieces of the screen to update. These are used to group * screen updates after a series of operations on the buffer. Since these are * designed to be set from anywhere, they need to be of type sig_atomic_t if * the target is a UNIX system. Otherwise, autoconf defines them to be ints. */ extern volatile sig_atomic_t refresh_complete; extern volatile sig_atomic_t refresh_text; extern volatile sig_atomic_t refresh_banner; /* A quick hack to make the minibuf work as expected */ int get_minibuf_col(void); /* Prototypes for drawing functions */ void init_slang(void); void init_slang_keys(void); void cleanup_slang(void); void draw_screen(buffer *buf); #endif /* LPE_SCREEN_H */ lpe-1.2.7/src/genmode.h0000644000175000017500000000051106737463317013614 0ustar adammadamm/* genmode.h * * Copyright (c) 1999 Chris Smith * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #ifndef LPE_GENMODE_H #define LPE_GENMODE_H #include "options.h" #include "buffer.h" void gen_init(buffer *buf); #endif /* defined(LPE_GENMODE_H) */ lpe-1.2.7/src/lpecomm.c0000644000175000017500000001377207136120256013624 0ustar adammadamm/* lpecomm.c * * Copyright (c) 1999 Chris Smith * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #include "options.h" #include SLANG_H #include #include "lpecomm.h" #include "cfg.h" /* Calculate the next tab stop position. Returns the number of spaces needed * to reach that position. This is separated into a separate function just to * make code look nicer. */ int next_mult (int now, int spacing) { return spacing - (now - ((now / spacing) * spacing)); } /* Make sure that the current cursor position is visible, scrolling the screen * as necessary is both the horizontal and vertical directions. Returns * non-zero if scrolling positions were updated (and hence the screen needs to * be redrawn) or zero if the current scrolling was okay. */ int check_scrolling (buffer * buf) { int ret = 0; while (buf->linenum < buf->scrollnum) { int i; for (i = 0; i <= cfg_get_global_int_with_default ("scroll_granularity", DEF_SCROLL_GRAN); i++) { if (buf->scrollpos->prev != NULL) { buf->scrollpos = buf->scrollpos->prev; buf->scrollnum--; } } ret = 1; } while (buf->linenum >= buf->scrollnum + SLtt_Screen_Rows - 1) { int i; for (i = 0; i <= cfg_get_global_int_with_default ("scroll_granularity", DEF_SCROLL_GRAN); i++) { if (buf->scrollpos->next != NULL) { buf->scrollpos = buf->scrollpos->next; buf->scrollnum++; } } ret = 1; } if (buf->scr_col < buf->scrollcol) { buf->scrollcol = buf->scr_col - cfg_get_global_int_with_default ("scroll_granularity", DEF_SCROLL_GRAN); if (buf->scrollcol < 0) buf->scrollcol = 0; ret = 1; } if (buf->scr_col >= buf->scrollcol + SLtt_Screen_Cols) { buf->scrollcol = buf->scr_col - SLtt_Screen_Cols + 1 + cfg_get_global_int_with_default ("scroll_granularity", DEF_SCROLL_GRAN); if (buf->scrollcol >= LINELEN (buf->pos)) buf->scrollcol = LINELEN (buf->pos) - 1; ret = 1; } return ret; } /* Adjust the column after switching to a new line. Tries to move the cursor * to the preferred column. If that fails, moves it to the last column in the * current line. This provides the sticky column behavior that makes editors * a lot nicer to use. */ void check_col (buffer * buf) { int txt_i = 0, scr_i = 0; while ((scr_i < buf->preferred_col) && (buf->pos.line->txt[txt_i] != '\0')) { if (buf->pos.line->txt[txt_i] == '\t') scr_i += next_mult (scr_i, cfg_get_global_int_with_default ("hard_tab_width", DEF_HARD_TAB_WIDTH)); // DEF_HARD_TAB_WIDTH ); else if (is_control (buf->pos.line->txt[txt_i])) scr_i += 2; else scr_i++; txt_i++; } buf->pos.col = txt_i; buf->scr_col = scr_i; } /* Recalculate the screen column from the current cursor position. Needed * because of the possibility of multi-column characters in the text. */ void set_scr_col (buffer * buf) { int i; buf->scr_col = 0; for (i = 0; i < buf->pos.col; i++) { if (buf->pos.line->txt[i] == '\t') buf->scr_col += next_mult (buf->scr_col, cfg_get_global_int_with_default ("hard_tab_width", DEF_HARD_TAB_WIDTH)); // DEF_HARD_TAB_WIDTH ); else if (is_control (buf->pos.line->txt[i])) buf->scr_col += 2; else buf->scr_col++; } } int is_control (char c) { unsigned char ch = c; if (ch < 9) return 1; if ((ch > 10) && (ch < 32)) return 1; if ((ch > 126) && (ch < 160)) return 1; return 0; } /* Insert a character in the buffer. Returns 0 on success, or -1 if it runs * out of memory. */ int add_char (int c, buffer * buf) { int ch, insc; char *p; if (buf->pos.line->txt_len == LINELEN (buf->pos) + 1) { /* need to allocate more space for the insertion */ char *nbuf; nbuf = (char *) realloc (buf->pos.line->txt, buf->pos.line->txt_len + cfg_get_global_int_with_default ("realloc_granularity", DEF_REALLOC_GRAN)); if (nbuf == NULL) return -1; buf->pos.line->txt = nbuf; buf->pos.line->txt_len += cfg_get_global_int_with_default ("realloc_granularity", DEF_REALLOC_GRAN); } p = buf->pos.line->txt + buf->pos.col; insc = c; while (*p != '\0') { ch = *p; *p = insc; insc = ch; p++; } *p = insc; *(p + 1) = '\0'; buf->pos.col++; if (c == '\t') buf->scr_col += next_mult (buf->scr_col, cfg_get_global_int_with_default ("hard_tab_width", DEF_HARD_TAB_WIDTH)); // DEF_HARD_TAB_WIDTH ); else if (is_control (c)) buf->scr_col += 2; else buf->scr_col++; buf->preferred_col = buf->scr_col; return 0; } /* Delete the character preceding the cursor */ void del_char (buffer * buf) { char *p; buf->pos.col--; if (buf->pos.line->txt[buf->pos.col] == '\t') set_scr_col (buf); else if (is_control (buf->pos.line->txt[buf->pos.col])) buf->scr_col -= 2; else buf->scr_col--; p = buf->pos.line->txt + buf->pos.col; do { *p = *(p + 1); p++; } while (*p != '\0'); buf->preferred_col = buf->scr_col; } /* The default implementation of auto-indentation. It just adds spaces to the * new line to match the indent of the previous line. If hard tabs are enabled * for the current buffer, it fills the indent with tabs as much as possible; * if not, it uses spaces. This implementation of auto-indent is used when * dynamic modes are disabled, if no mode is found, or if the mode does not * implement a replacement for auto-indentation. */ void def_indent (buffer * buf, char ch) { char *p; if (ch != '\n') return; for (p = buf->pos.line->prev->txt; (*p == ' ') || (*p == '\t'); p++) add_char (*p, buf); /* kill the contents of the previous line if there were whitespaces * * only. This way, autoindent doesn't leave a bunch of random whitespace * * when it's not necessary. */ if (*p == '\0') *(buf->pos.line->prev->txt) = 0; } lpe-1.2.7/src/buffer.c0000644000175000017500000003133210327514675013441 0ustar adammadamm/* buffer.c * * Copyright (c) 1999 Chris Smith * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #include "options.h" #include #include #include #include #include #include #include #include #include #include #include LIMITS_H #include "lpe.h" #include "genmode.h" #include "buffer.h" #include "cfg.h" #include "strfuncs.h" #include "common.h" #if !defined(HAVE_FLOCK) || defined(DUMMY_FLOCK) #define flock(a,b) #endif /* This points to the current buffer in a circular doubly linked list of open * buffers. */ buffer *the_buf; /* The killbuf -- a singly linked list (prev pointer is invalid and should be * always set to NULL) of lines that were deleted via the kill command. These * can be inserted into the buffer using the yank command, so they must be * saved. The kill buf is purposely built from the same linked list node * structure as the main buffer. This is because it feels cleaner not to * require memory allocation to delete part of the buffer, so I didn't want to * have to allocate new nodes in the killbuf linked list. * * is_killing is a flag indicating if the last thing the user did was to kill * a line. If so, killing a line now would add it to the end of the killbuf as * part of a killed block. If not, killing a line would clear the killbuf and * insert the newly killed line. */ buf_line *killbuf; int is_killing; void set_buf_mode (buffer * buf, char *reqname) { DIR *dir; char name[PATH_MAX]; char *pathpos, *nextcolon; void *handle = NULL; int found; if ((reqname) && (!strcmp (reqname, "genmode"))) { buf->mode.handle = NULL; buf->mode.init = gen_init; buf->mode.uninit = NULL; buf->mode.enter = NULL; buf->mode.leave = NULL; buf->mode.extkey = NULL; buf->mode.flashbrace = NULL; buf->mode.highlight = NULL; buf->mode.indent = NULL; gen_init (buf); return; } pathpos = getenv ("LPE_MODULE_PATH"); if (pathpos == NULL) pathpos = cfg_get_global_string_with_default ("module_path", DEF_MODULE_PATH); found = 0; do { char *basename; struct dirent *ent; if (*pathpos == '~') { char *home = getenv ("HOME"); strcpy (name, (home == NULL) ? "/" : home); pathpos++; } else name[0] = '\0'; nextcolon = strchr (pathpos, ':'); if (nextcolon != NULL) { strncat (name, pathpos, nextcolon - pathpos); pathpos += nextcolon - pathpos + 1; } else strcpy (name, pathpos); basename = name + strlen (name); if (*(basename - 1) != '/') { *(basename++) = '/'; *basename = '\0'; } if (reqname != NULL) { struct stat st; strcpy (basename, reqname); strcat (basename, ".so"); stat (name, &st); if (S_ISREG (st.st_mode)) { handle = dlopen (name, RTLD_LAZY); if (handle != NULL) found = 1; } } else { dir = opendir (name); if (dir == NULL) continue; while ((!found) && ((ent = readdir (dir)) != NULL)) { struct stat st; int (*accept) (buffer *); strcpy (basename, ent->d_name); stat (name, &st); if (!S_ISREG (st.st_mode)) continue; handle = dlopen (name, RTLD_LAZY); if (handle == NULL) continue; accept = (int (*)(buffer *)) dlsym (handle, "mode_accept"); if ((accept == NULL) || !(*accept) (buf)) { dlclose (handle); continue; } found = 1; } closedir (dir); } } while ((!found) && (nextcolon != NULL)); if (found) { buf->mode.handle = handle; buf->mode.data = NULL; buf->mode.init = (void (*)(buffer *)) dlsym (handle, "mode_init"); buf->mode.uninit = (void (*)(buffer *)) dlsym (handle, "mode_uninit"); buf->mode.enter = (void (*)(buffer *)) dlsym (handle, "mode_enter"); buf->mode.leave = (void (*)(buffer *)) dlsym (handle, "mode_leave"); buf->mode.extkey = (void (*)(buffer *, int)) dlsym (handle, "mode_extkey"); buf->mode.flashbrace = (int (*)(buffer *)) dlsym (handle, "mode_flashbrace"); buf->mode.highlight = (int (*)(buffer *, buf_line *, int, int *, int *)) dlsym (handle, "mode_highlight"); buf->mode.indent = (int (*)(buffer *, char)) dlsym (handle, "mode_indent"); } else { buf->mode.handle = NULL; buf->mode.data = NULL; buf->mode.init = gen_init; buf->mode.uninit = NULL; buf->mode.enter = NULL; buf->mode.leave = NULL; buf->mode.extkey = NULL; buf->mode.flashbrace = NULL; buf->mode.highlight = NULL; buf->mode.indent = NULL; } if (buf->mode.init != NULL) (*buf->mode.init) (buf); } /* Frees an entire linked list of lines; used for error recovery when reading * a buffer. */ void free_list (buf_line * lst) { buf_line *iter; for (iter = lst; iter != NULL;) { buf_line *t; t = iter->next; free (iter->txt); free (iter); iter = t; } } /* Reads text from the specified stdio stream up to the end of stream, storing * the result in a linked list of buf_line. It returns a pointer to the first * line on success, or NULL on failure. If the function fails, errno will * remain set to the error, or to ENOMEM to indicate a failure to allocate * memory. */ buf_line * read_stream (FILE * fp) { buf_line *start; buf_pos pos; start = (buf_line *) malloc (sizeof (buf_line)); if (start == NULL) { errno = ENOMEM; return NULL; } start->txt = (char *) malloc (1); if (start->txt == NULL) { free (start); errno = ENOMEM; return NULL; } start->txt[0] = '\0'; start->txt_len = 1; start->prev = NULL; start->next = NULL; pos.line = start; pos.col = 0; while (!feof (fp)) { int c; c = getc (fp); if (c == EOF) { if (ferror (fp)) { /* There was an error reading from the file. Clean up the * * buffer so far and then report the error. */ int err; err = errno; free_list (start); errno = err; return NULL; } pos.line->txt[pos.col] = '\0'; } else if (c == '\n') { buf_line *t; pos.line->txt[pos.col] = '\0'; t = (buf_line *) malloc (sizeof (buf_line)); if (t == NULL) { free_list (start); errno = ENOMEM; return NULL; } t->txt = (char *) malloc (1); if (t->txt == NULL) { free_list (start); free (t); errno = ENOMEM; return NULL; } pos.line->next = t; pos.line->next->txt_len = 1; pos.line->next->prev = pos.line; pos.line->next->next = NULL; pos.line = pos.line->next; pos.col = 0; } else { pos.line->txt[pos.col] = (char) c; if (++pos.col == pos.line->txt_len) { char *ntxt; ntxt = (char *) realloc (pos.line->txt, pos.line->txt_len + cfg_get_global_int_with_default ("realloc_granularity", DEF_REALLOC_GRAN)); if (ntxt == NULL) { free_list (start); errno = ENOMEM; return NULL; } pos.line->txt = ntxt; pos.line->txt_len += cfg_get_global_int_with_default ("realloc_granularity", DEF_REALLOC_GRAN); } } } return start; } /* Writes text from a linked list of buf_line to the specified stdio stream. * It returns 0 in success, or -1 on error. If the function fails, errno will * remain set to the error, or to ENOMEM to indicate a failure to allocate * memory. */ int write_stream (FILE * fp, buf_line * start) { buf_line *curline; for (curline = start; curline != NULL;) { if (fputs (curline->txt, fp) == -1) return -1; curline = curline->next; if (curline != NULL) { if (putc ('\n', fp) == EOF) return -1; } } return 0; } /* Strips the trailing carriage returns from all lines in a buffer. This make$+ * files written in DOS and Windows much more pleasant to edit and work with. * It only should be done if the user has not specified the 'keepcr' flag in * the configuration file. * * It returns zero if there are any lines not terminated by a carriage return, * excluding the last line. It returns non-zero if all lines in the files end * in a carriage return. The intent is that when the file is later saved, the * carriage returns can be replaced to preserve the file's original format. */ static int stripcr(buffer *buf) { buf_line *curline; int ret = 1; for (curline = buf->text; curline->next != NULL; curline = curline->next) { int i; i = strlen(curline->txt); if (curline->txt[i - 1] == '\r') curline->txt[i - 1] = '\0'; else ret = 0; } return ret; } /* Opens a file in the specified buffer, with the specified file name. Loads * the file from disk and initializes all members of the buffer. If the * filename is NULL, opens standard input. If the modename is NULL, chooses * an appropriate mode by normal means. Returns -1 on error or 0 on success. * In case of an error, if the error was in file I/O, errno is set to the * system error code. If the error was out of memory, errno is explicitly set * to ENOMEM to indicate this fact. */ int open_buffer (buffer * buf, char *fname, char *modename) { FILE *fp; if (fname != NULL) fp = fopen(fname, "r"); else fp = stdin; if (fp == NULL) { if (errno != ENOENT) return -1; buf->text = (buf_line *) malloc (sizeof (buf_line)); if (buf->text == NULL) { errno = ENOMEM; return -1; } buf->text->txt = (char *) malloc (1); if (buf->text->txt == NULL) { free (buf->text); errno = ENOMEM; return -1; } buf->text->txt[0] = '\0'; buf->text->txt_len = 1; buf->text->prev = NULL; buf->text->next = NULL; buf->rdonly = 0; } else { int err; flock (fileno (fp), LOCK_SH); buf->text = read_stream (fp); err = errno; if (access (fname, W_OK) == -1) buf->rdonly = 1; else buf->rdonly = 0; flock (fileno (fp), LOCK_UN); fclose (fp); if (buf->text == NULL) { errno = err; return -1; } } buf->modified = 0; buf->scrollpos = buf->text; buf->scrollnum = 0; buf->scrollcol = 0; buf->pos.line = buf->text; buf->pos.col = 0; buf->scr_col = 0; buf->preferred_col = 0; buf->linenum = 0; if (fname != NULL) { buf->fname = calloc(100, sizeof(char)); strcpy(buf->fname, fname); buf->name = strrchr (buf->fname, '/'); if (buf->name == NULL) buf->name = buf->fname; else ++buf->name; buf->fname_valid = 1; } else { buf->fname = strdup("(stdin)"); buf->name = buf->fname; buf->fname_valid = 0; } buf->mode_name = NULL; set_buf_mode (buf, modename); return 0; } /* Close the specified buffer, cleaning up after it. */ void close_buffer (buffer * buf) { if (!buf) return; if (buf->mode.uninit) (*buf->mode.uninit) (buf); if (buf->mode.handle) dlclose (buf->mode.handle); while (buf->text != NULL) { buf_line *t; t = buf->text->next; free (buf->text->txt); free (buf->text); buf->text = t; } free(buf->fname); } /* Save the current buffer to disk, using the file name specified by the buf * structure. Return 0 on success, -1 on failure with errno set to the error * responsible for failure. */ int save_buffer (buffer * buf) { FILE *fp; int ret, copied = 1; struct stat st; char *dir, *file, *bakname; /* If the previous file exists, copy it to a backup file before * writing the new file. This means two things: * 1. The previous file isn't destroyed if we somehow fail to write. * 2. We copy-on-write hardlinks, rather than clobbering all instances of the inode. */ ret = strlen( buf->fname ) / 4096 + 1; dir = (char*)malloc( sizeof(char) * 4096 * ret ); while( getcwd( dir, 4096 * ret ) == 0 ){ ret++; free( dir ); dir = (char*)malloc( sizeof(char*) * 4096 * ret ); } strcpy( dir, buf->fname ); file = strdup( buf->fname ); bakname = (char*)malloc( sizeof(char) * (strlen(dir) + strlen(file) + 7 )); sprintf(bakname,"%s/.%s.lpe",dirname(dir),basename(file)); if(copy(buf->fname,bakname) != 0) copied = 0; fp = fopen (buf->fname, "w"); if (fp == NULL) { if(copied) unlink(bakname); ret = -1; goto save_buffer_return; } flock (fileno (fp), LOCK_EX); ret = write_stream (fp, buf->text); flock (fileno (fp), LOCK_UN); fclose (fp); if (ret == 0) { buf->modified = 0; if(copied) unlink(bakname); } else { unlink(buf->fname); if(copied) rename(bakname,buf->fname); /* FIXME: Will loose all link information */ } save_buffer_return: free( dir ); free( file ); free( bakname ); return ret; } lpe-1.2.7/src/cfg.c0000644000175000017500000000462410255442655012731 0ustar adammadamm/* cfg.c * * Copyright (c) 2000 Chris Smith * * Author: * Gergely Nagy * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #include #include "strfuncs.h" #include "options.h" #include "cfg-core.h" #include #include #include #include SLANG_H #ifdef HAVE_STRING_H #include #endif int cfg_errno; void cfg_init (void) { cfg_core_init (); SLadd_intrinsic_variable ("LPE_CONFIG_FILE", &LPE_CONFIG_FILE, SLANG_STRING_TYPE, 1); if (access (DATADIR "/lpe/init.sl", R_OK) == 0) { if (SLang_load_file (DATADIR "/lpe/init.sl") == -1) { SLang_restart (1); SLang_set_error(0); } } } char * cfg_get_option_string (char *mode, char *section, char *option) { char *id; char *result; id = (char *) malloc (strlen (mode) + strlen (section) + strlen (option) + 4); sprintf (id, "%s.%s.%s", mode, section, option); result = cfg_core_get_str (id); free (id); return result; } char * cfg_get_option_string_with_default (char *mode, char *section, char *option, char *def) { char *val; val = cfg_get_option_string (mode, section, option); if ((!val && !cfg_errno) || (val && strlen (val) == 0)) { val = cfg_get_option_string ("global", section, option); if ((!val && !cfg_errno) || (val && strlen (val) == 0)) { val = cfg_get_option_string ("global", section, "default"); if ((!val && !cfg_errno) || (val && strlen (val) == 0)) { if (def) return g_strdup (def); else return NULL; } } } if (val && !strcmp (val, "NULL")) return NULL; else return val; } int cfg_get_option_int (char *mode, char *section, char *option) { char *id; int result; id = (char *) malloc (strlen (mode) + strlen (section) + strlen (option) + 4); sprintf (id, "%s.%s.%s", mode, section, option); result = cfg_core_get_int (id); free (id); return result; } int cfg_get_option_int_with_default (char *mode, char *section, char *option, int def) { int val; val = cfg_get_option_int (mode, section, option); if (val < 0 && (val = cfg_get_option_int ("global", section, option)) < 0) { val = cfg_get_option_int ("global", section, "default"); if (val < 0) return def; else return val; } else return val; } lpe-1.2.7/src/Makefile.am0000644000175000017500000000142310100310070014022 0ustar adammadammMAINTAINERCLEANFILES = Makefile.in SUBDIRS = modes bin_PROGRAMS = lpe lpe_SOURCES = \ buffer.c buffer.h \ cfg-core.c cfg-core.h \ cfg.c cfg.h \ exports.c exports.h \ genmode.c genmode.h \ help.c help.h \ highlight.h \ i18n.h \ input.c input.h \ lpe.c lpe.h \ lpecomm.c lpecomm.h \ minibuf.c minibuf.h \ mode-utils.c mode-utils.h \ options.h \ screen.c screen.h \ strfuncs.c strfuncs.h \ common.c common.h INCLUDES = -DDATADIR=\"$(datadir)\" lpe_LDADD = @INTLLIBS@ @INTLOBJS@ @DL_LIB@ @SLANG_LIB@ -lncurses lpe_LDFLAGS = @lpe_LDFLAGS@ lpe_DEPENDENCIES = @lpe_DEPS@ @INTLOBJS@ if USE_INCLUDED_LIBINTL AM_CPPFLAGS = -DLOCALEDIR=\"$(datadir)/@DATADIRNAME@\" -I$(top_srcdir)/intl else AM_CPPFLAGS = -DLOCALEDIR=\"$(datadir)/locale\" endif EXTRA_DIST = templ.c templ.h lpe-1.2.7/src/strfuncs.c0000644000175000017500000000457607136120256014041 0ustar adammadamm/* strfuncs.c * * Copyright (c) 1999 Chris Smith * * Author: * The GLib team, copied from glib 1.2.6 sourcetree * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #include #include #include #include #include #include #include #ifdef HAVE_STRING_H #include #endif int g_strcasecmp (const char *s1, const char *s2) { #ifdef HAVE_STRCASECMP if (s1 == NULL || s2 == NULL) return 0; return strcasecmp (s1, s2); #else int c1, c2; if (s1 == NULL || s2 == NULL) return 0; while (*s1 && *s2) { /* According to A. Cox, some platforms have islower's that * don't * work right on non-uppercase */ c1 = isupper ((char) *s1) ? tolower ((char) *s1) : *s1; c2 = isupper ((char) *s2) ? tolower ((char) *s2) : *s2; if (c1 != c2) return (c1 - c2); s1++; s2++; } return (((int) (char) *s1) - ((int) (char) *s2)); #endif } int g_strncasecmp (const char *s1, const char *s2, unsigned int n) { #ifdef HAVE_STRNCASECMP return strncasecmp (s1, s2, n); #else int c1, c2; if (s1 == NULL || s2 == NULL) return 0; while (n-- && *s1 && *s2) { /* According to A. Cox, some platforms have islower's that * don't * work right on non-uppercase */ c1 = isupper ((char) *s1) ? tolower ((char) *s1) : *s1; c2 = isupper ((char) *s2) ? tolower ((char) *s2) : *s2; if (c1 != c2) return (c1 - c2); s1++; s2++; } if (n) return (((int) (char) *s1) - ((int) (char) *s2)); else return 0; #endif } void g_strdown (char *string) { register char *s; if (string == NULL) return; s = string; while (*s) { *s = tolower (*s); s++; } } void g_strup (char *string) { register char *s; if (string == NULL) return; s = string; while (*s) { *s = toupper (*s); s++; } } char * g_strdup (const char *string) { char *new_str; if (string) { new_str = (char *) malloc (strlen (string) + 1); strcpy (new_str, string); new_str[strlen (string)] = '\0'; } else new_str = NULL; return new_str; } char * g_strndup (const char *string, unsigned int n) { char *new_str; if (string) { new_str = (char *) malloc (n + 1); strncpy (new_str, string, n); new_str[n] = '\0'; } else new_str = NULL; return new_str; } lpe-1.2.7/src/options.h0000644000175000017500000000165007136114606013662 0ustar adammadamm/* options.h * * Copyright (c) 1999 Chris Smith * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #ifndef LPE_OPTIONS_H #define LPE_OPTIONS_H #include "config.h" #ifdef HAVE_LIMITS_H #define LIMITS_H "limits.h" #elif defined(HAVE_SYS_SYSLIMITS_H) #define LIMITS_H "sys/syslimits.h" #endif #define MAX_MACRO_KEYS 1024 #define MAX_MACRO_ANSWER_LEN 1024 /* * These are just defaults, they can be overridden from * configuration files. */ #define CMD_SH "sh" #define CMD_AWK "awk" #define CMD_SED "sed" #define DEF_MODULE_PATH "~/.lpe:/usr/local/lib/lpe:/usr/lib/lpe:/etc/lpe" #define DEF_HARD_TAB_WIDTH 8 #define DEF_SOFT_TAB_WIDTH 4 #define DEF_FLASH_TIME 3 #define DEF_SCROLL_GRAN 0 #define DEF_REALLOC_GRAN 10 #define DEF_EOF_FILL NULL /* * Other things that are used in some places... */ char *LPE_CONFIG_FILE; #endif /* LPE_OPTIONS_H */ lpe-1.2.7/src/lpe.c0000644000175000017500000001662610556651340012754 0ustar adammadamm/* lpe.c * * Copyright (c) 1999 Chris Smith * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #include "options.h" #include #include #include #include #include #include #include #include #include "lpe.h" #include "buffer.h" #include "input.h" #include "screen.h" #include "cfg.h" #include "strfuncs.h" #include "exports.h" /* A flag indicating a desire to quit the editor. This is set whenever a * command should cause an exit. */ int quit; /* Structure used to hold options read from the command line. This is only * used to pass to the command line parser and read the results, so there's no * specific need to make the struct definition accessible outside of lpe.c * * fname: name of the file to open * mode: name of the preferred mode -- this exists even when dynamic modes are * turned off, to make getting parameters right a little easier */ struct lpe_opts { char *fname; char *mode; int line; }; /* free all buffers */ void free_bufs () { buffer *node; if (!the_buf) return; while (the_buf->next != the_buf && the_buf->next != NULL) { if (node) { node = the_buf->next; if ( the_buf->next ) { the_buf->next = the_buf->next->next; the_buf->next->prev = the_buf; } free(node); } } free(the_buf); } /* Kill the editor with the specified error message. This function does not * provide the user with any opportunity to save the buffer, and any changes * since the last save will be lost. */ void die (char *s, ...) { char buf[160]; va_list args; cleanup_slang (); free_bufs (); sprintf (buf, "lpe: %s\n", s); va_start (args, s); vfprintf (stderr, buf, args); va_end (args); exit (1); } /* A function to handle refreshing the screen in certain situations, such as * when the user has just resumed lpe from a suspended session or the terminal * has just been resized. */ #ifndef __STRICT_ANSI__ static void sig_handler (int signum) { refresh_complete = 1; } #endif /* ! __STRICT_ANSI__ */ /* Print a version message and terminate */ static void version (void) { printf (_("%s version %s\n"), PACKAGE, VERSION); exit (0); } /* Print the dedication and terminate */ static void dedication (void) { printf (_("The lpe text editor is dedicated to all those who died at\n" "Columbine High School in Littleton, CO, USA on April 20, 1999.\n" "We will always remember you.\n")); exit (0); } /* Print a usage message to standard error and terminate. The hint parameter * provides a pointer to the argument that prompted this error, or is NULL if * the message was requested (eg, --help). It's ignored for now, but most * likely won't be later. */ static void usage (char *hint) { if (hint != NULL) fprintf (stderr, _("error in option: %s\n"), hint); fprintf (stderr, _ ("usage:\t'lpe [--mode mode] [--] file'\topens file for editing\n" " \t'lpe --version' \tprints version number\n" " \t'lpe --help' \tprints this help message\n")); if (hint == NULL) exit (0); else exit (1); } /* Parse command line arguments to lpe */ static void parse_args (int argc, char *argv[], struct lpe_opts *opts) { int i; /* Initialize the options so they don't have leftover values */ opts->fname = NULL; opts->mode = NULL; for (i = 1; i < argc; i++) { if (argv[i][0] == '-' || argv[i][0] == '+') { if (strcmp (argv[i], "--version") == 0 || strcmp (argv[i], "-V") == 0) version (); if (strcmp (argv[i], "--dedication") == 0) dedication (); if (strcmp (argv[i], "--help") == 0 || strcmp (argv[i], "-h") == 0) usage (NULL); if (strcmp (argv[i], "--rcfile") == 0 || strcmp (argv[i], "-F") == 0) { if (argc == i + 1) usage (argv[i]); LPE_CONFIG_FILE = argv[++i]; continue; } if (strcmp (argv[i], "--mode") == 0 || strcmp (argv[i], "-m") == 0) { if (argc == i + 1) usage (argv[i]); opts->mode = argv[++i]; continue; } if (argv[i][0] == '+') { if(!argv[i][1]) opts->line = strtol(argv[++i],NULL,0); else opts->line = strtol(argv[i]+1,NULL,0); opts->line--; continue; } if (strcmp (argv[i], "--") == 0) break; usage (argv[i]); } else { if (i + 1 != argc) { usage (argv[i + 1]); } else opts->fname = argv[i]; } } i++; while (i < argc) { /* The user indicated a desire to treat future arguments as files, so * * don't parse any options from here on out. */ if (i + 1 != argc) { usage (argv[i + 1]); } else opts->fname = argv[i]; i++; } } /* Application entry point */ int main (int argc, char *argv[]) { struct lpe_opts opts; buffer *node; #ifndef __STRICT_ANSI__ struct sigaction sa; memset (&sa, 0, sizeof (sa)); sa.sa_handler = sig_handler; sigaction (SIGCONT, &sa, NULL); sigaction (SIGWINCH, &sa, NULL); #endif /* ! __STRICT_ANSI__ */ setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); if (getenv ("HOME")) { LPE_CONFIG_FILE = (char *) malloc (strlen (getenv ("HOME")) + strlen ("/.lpe/custom") + 1); /* space for trailing null */ LPE_CONFIG_FILE[0] = '\0'; strcat (LPE_CONFIG_FILE, getenv ("HOME")); strcat (LPE_CONFIG_FILE, "/.lpe/custom"); } else { LPE_CONFIG_FILE = g_strdup (".lperc"); } memset (&opts, 0, sizeof (struct lpe_opts)); parse_args (argc, argv, &opts); if ((opts.fname == NULL) && (isatty(0))) usage(NULL); init_slang (); init_slang_keys (); export_all (); cfg_init (); the_buf = malloc(sizeof(buffer)); if (the_buf == NULL) die("Out of memory"); memset(the_buf, 0, sizeof(buffer)); if (open_buffer (the_buf, opts.fname, opts.mode) == -1) die (strerror (errno)); the_buf->prev = the_buf->next = the_buf; killbuf = NULL; is_killing = 0; if (the_buf->mode.enter) (*the_buf->mode.enter) (the_buf); if(opts.line > 0) { int line_number = opts.line; /* move cursor down */ while(opts.line && the_buf->pos.line->next) { the_buf->pos.line = the_buf->pos.line->next; the_buf->linenum++; opts.line--; } check_scrolling(the_buf); if(!opts.line) { /* attempt to center the selected line */ int centerint = SLtt_Screen_Rows >> 1; buf_line *centerline = the_buf->pos.line; if(centerint < line_number) { if(line_number < SLtt_Screen_Rows) centerint -= (SLtt_Screen_Rows - line_number); while(centerint-- && centerline && the_buf->scrollpos->next) { centerline = centerline->next; the_buf->scrollpos = the_buf->scrollpos->next; the_buf->scrollnum++; } } } refresh_text = 1; refresh_banner = 1; } while (!quit) process_input (the_buf); if (the_buf->mode.leave) (*the_buf->mode.leave) (the_buf); node = the_buf; do { close_buffer(node); if (node) node = node->next; else break; } while (node != the_buf); free_bufs(); cleanup_slang (); return 0; } lpe-1.2.7/src/minibuf.h0000644000175000017500000000263406737463317013637 0ustar adammadamm/* minibuf.h * * Copyright (c) 1999 Chris Smith * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #ifndef LPE_MINIBUF_H #define LPE_MINIBUF_H #include "buffer.h" /* A structure to represent the minibuf * * vis: flag indicating if the minibuf is visible * focus: flag indicating of the minibuf has keyboard focus * pos: the cursor position in the minibuf * scroll: the position of the leftmost visible character in the minibuf * startcol: the screen column at which the minibuf should start displaying * width: number of columns reserved for just the text part of the minibuf * compl: filename completion flags * label: the prompt when asking a question in the minibuf * text: the primary text -- either that typed or displayed */ typedef struct { int vis; int focus; int pos; int scroll; int width; int compl; char label[50]; char text[150]; } minibuf; /* The global minibuf. See minibuf.c for details */ extern minibuf the_mbuf; /* Prototypes for the external interface to the minibuf */ char *mbuf_ask(buffer *buf, char *prompt, int compl); void mbuf_tell(buffer *buf, char *msg); /* Completion flags */ #define MBUF_NO_COMPL 0x0000 #define MBUF_FILE_COMPL 0x0004 #define MBUF_MODE_COMPL 0x0008 #define MBUF_PEND_COMPL 0x0001 /* Completion pending - last key was a '\t' */ #endif /* LPE_MINIBUF_H */ lpe-1.2.7/src/genmode.c0000644000175000017500000000142107136120256013572 0ustar adammadamm/* genmode.c * * Copyright (c) 1999 Chris Smith * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #include "options.h" #include "genmode.h" #include "mode-utils.h" void gen_init (buffer * buf) { if (buf->mode_name == NULL) { buf->hardtab = mode_util_get_option_with_default ("genmode", "hardtab", 1); buf->autoindent = mode_util_get_option_with_default ("genmode", "autoindent", 0); buf->offerhelp = mode_util_get_option_with_default ("genmode", "offerhelp", 1); buf->highlight = mode_util_get_option_with_default ("genmode", "highlight", 0); buf->flashbrace = mode_util_get_option_with_default ("genmode", "flashbrace", 0); } buf->mode_name = "genmode"; } lpe-1.2.7/src/cfg.h0000644000175000017500000000235607314070217012727 0ustar adammadamm/* cfg.h * * Copyright (c) 2000 Chris Smith * * Author: * Gergely Nagy * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #ifndef LPE_CFG_H #define LPE_CFG_H /** * cfg_init: load initializing SLang scripts * * This needs to be called only once. It loads the SLang scripts needed by * cfg_get_option and friends. * * Returns nothing. **/ void cfg_init ( void ); char *cfg_get_option_string ( char *mode, char *section, char *option ); char *cfg_get_option_string_with_default ( char *mode, char *secion, char *option, char *def ); int cfg_get_option_int ( char *mode, char *section, char *option ); int cfg_get_option_int_with_default ( char *mode, char *section, char *option, int def ); #define cfg_get_global_int(id) \ cfg_get_option_int ( "global", "general", id ) #define cfg_get_global_int_with_default(id,def) \ cfg_get_option_int_with_default ( "global", "general", id, def ) #define cfg_get_global_string(id) \ cfg_get_option_string ( "global", "general", id ) #define cfg_get_global_string_with_default(id,def) \ cfg_get_option_string_with_default ( "global", "general", id, def ) #endif /* ! LPE_CFG_H */ lpe-1.2.7/src/buffer.h0000644000175000017500000000137207136723415013445 0ustar adammadamm/* buffer.h * * Copyright (c) 1999 Chris Smith * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #ifndef LPE_BUFFER_H #define LPE_BUFFER_H #include #include "lpecomm.h" /* Some global variables. See buffer.c for an explanation of these. */ extern buffer *the_buf; extern buf_line *killbuf; extern int is_killing; /* Prototypes for functions defined in buffer.c */ void set_buf_mode(buffer *buf, char *reqname); void free_list(buf_line *list); buf_line *read_stream(FILE *fp); int write_stream(FILE *fp, buf_line *start); int open_buffer(buffer *buf, char *fname, char *modename); void close_buffer(buffer *buf); int save_buffer(buffer *buf); #endif /* LPE_BUFFER_H */ lpe-1.2.7/src/templ.h0000644000175000017500000000036106737463317013322 0ustar adammadamm/* templ.h * * Copyright (c) 1999 Chris Smith * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #ifndef LPE_TEMPL_H #define LPE_TEMPL_H #endif /* LPE_TEMPL_H */ lpe-1.2.7/src/i18n.h0000644000175000017500000000117407135104766012754 0ustar adammadamm #ifndef LPE_I18N_H #define LPE_I18N_H #ifdef ENABLE_NLS # include # define _(String) gettext (String) # ifdef gettext_noop # define N_(String) gettext_noop (String) # else # define N_(String) (String) # endif #else # define textdomain(String) (String) # define gettext(String) (String) # define dgettext(Domain,Message) (Message) # define dcgettext(Domain,Message,Type) (Message) # define bindtextdomain(Domain,Directory) (Domain) # define _(String) (String) # define N_(String) (String) #endif #ifdef HAVE_LOCALE_H # include #endif #endif /* ! LPE_I18N_H */ lpe-1.2.7/src/templ.c0000644000175000017500000000030407136120256013274 0ustar adammadamm/* templ.c * * Copyright (c) 1999 Chris Smith * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #include "options.h" lpe-1.2.7/src/exports.h0000644000175000017500000000051107314070233013661 0ustar adammadamm/* exports.h * * Copyright (c) 2000 Chris Smith * * Author: * Gergely Nagy * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #ifndef LPE_EXPORTS_H #define LPE_EXPORTS_H void export_all ( void ); #endif /* LPE_EXPORTS_H */ lpe-1.2.7/src/help.h0000644000175000017500000000046607011613547013123 0ustar adammadamm/* help.h * * Copyright (c) 1999 Chris Smith * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #ifndef LPE_HELP_H #define LPE_HELP_H extern buffer help_buf; extern int is_help; buffer *get_helpbuf(void); #endif /* LPE_HELP_H */ lpe-1.2.7/src/cfg-core.c0000644000175000017500000001432407743362671013664 0ustar adammadamm/* cfg-core.c * * Copyright (c) 2000 Chris Smith * * Author: * Gergely Nagy * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #include #include "cfg-core.h" #include "strfuncs.h" #include #include #include #ifdef HAVE_STRING_H #include #endif typedef enum { LPE_OPT_STRING, LPE_OPT_INT, LPE_OPT_BOOL } LpeOptionType; typedef struct _LpeOption LpeOption; struct _LpeOption { LpeOptionType type; union { char *string; long integer; int boolean; } value; }; LpeOption **LpeOptionTable; char *LpeOptionHash; long LpeOptionTableSize; static LpeOption *cfg_core_get_option (char *name); static void cfg_core_set_option (char *name, LpeOption * value); LpeOption * cfg_core_get_option (char *name) { char *t_hentry; char *t_sstring; unsigned int pos = 0; LpeOption *opt = NULL; /* * If the lookup table is not initialized yet, * we don't perform any lookup. */ if (!LpeOptionHash) return NULL; /* * We search for "\n[name]=" in the lookup table... */ t_sstring = (char *) alloca (strlen (name) + 5); sprintf (t_sstring, "\n%s=", name); if ((t_hentry = strstr (LpeOptionHash, t_sstring)) != NULL) { /* * All right, we found it! * Now extract the position from it... */ strcat (t_sstring, "%d\n"); sscanf (t_hentry, t_sstring, &pos); opt = LpeOptionTable[pos]; } /* * Well... this is not really good... * export MALLOC_CHECK_=2 and it aborts right here */ /* free ( t_sstring ); */ return opt; } void cfg_core_set_option (char *name, LpeOption * value) { LpeOption *opt; char *hentry; char num[128]; char *tmp; /* * First of all, look up if it exists. */ if ((opt = cfg_core_get_option (name)) != NULL) { if (opt->type == LPE_OPT_STRING) free (opt->value.string); switch (value->type) { case LPE_OPT_STRING: opt->value.string = value->value.string; break; case LPE_OPT_INT: opt->value.integer = value->value.integer; break; case LPE_OPT_BOOL: opt->value.boolean = value->value.boolean; break; } opt->type = value->type; } else { /* * Determine the position we'll put the new entry... */ LpeOptionTableSize++; LpeOptionTable = realloc (LpeOptionTable, sizeof (LpeOption) * (LpeOptionTableSize + 1)); /* * Insert the entry */ /* sizeof(LpeOption), not sizeof(pointer)! */ opt = (LpeOption *) malloc (sizeof (*value)); switch (value->type) { case LPE_OPT_STRING: opt->value.string = value->value.string; break; case LPE_OPT_INT: opt->value.integer = value->value.integer; break; case LPE_OPT_BOOL: opt->value.boolean = value->value.boolean; break; } opt->type = value->type; LpeOptionTable[LpeOptionTableSize] = opt; /* * And now insert a reference into the lookup table... */ sprintf (num, "%li", LpeOptionTableSize); hentry = (char *) malloc (strlen (name) + strlen (num) + 4); sprintf (hentry, "%s=%s\n", name, num); tmp = (char *) malloc (strlen (LpeOptionHash) + strlen (hentry) + 10); tmp[0] = '\0'; strcat (tmp, LpeOptionHash); strcat (tmp, hentry); free (LpeOptionHash); LpeOptionHash = tmp; free (hentry); } } /******************** * Public functions * ********************/ void cfg_core_init (void) { LpeOptionTable = NULL; LpeOptionHash = g_strdup ("\n"); LpeOptionTableSize = -1; } void cfg_core_set_int (char *name, long value) { LpeOption *opt; opt = (LpeOption *) malloc (sizeof (LpeOption)); opt->type = LPE_OPT_INT; opt->value.integer = value; cfg_core_set_option (name, opt); free (opt); } void cfg_core_set_bool (char *name, int value) { LpeOption *opt; opt = (LpeOption *) malloc (sizeof (LpeOption)); opt->type = LPE_OPT_BOOL; opt->value.boolean = (value <= 0) ? 0 : 1; cfg_core_set_option (name, opt); free (opt); } void cfg_core_set_str (char *name, char *value) { LpeOption *opt; opt = (LpeOption *) malloc (sizeof (LpeOption)); opt->type = LPE_OPT_STRING; opt->value.string = g_strdup (value); cfg_core_set_option (name, opt); free (opt); } long cfg_core_get_int (char *name) { LpeOption *opt; opt = cfg_core_get_option (name); if (opt) { switch (opt->type) { case LPE_OPT_INT: return opt->value.integer; break; case LPE_OPT_BOOL: return (opt->value.boolean <= 0) ? 0 : 1; break; case LPE_OPT_STRING: return atol (opt->value.string); break; } } return -1; } char * cfg_core_get_str (char *name) { LpeOption *opt; char *str; opt = cfg_core_get_option (name); if (opt) { switch (opt->type) { case LPE_OPT_STRING: return g_strdup ( opt->value.string ); break; case LPE_OPT_BOOL: return (opt->value.boolean <= 0) ? NULL : ""; break; case LPE_OPT_INT: str = (char *) malloc (65); sprintf (str, "%li", opt->value.integer); return str; break; } } return NULL; } int cfg_core_get_bool (char *name) { LpeOption *opt; opt = cfg_core_get_option (name); if (opt) { switch (opt->type) { case LPE_OPT_INT: return (opt->value.integer <= 0) ? 0 : 1; break; case LPE_OPT_BOOL: return (opt->value.boolean <= 0) ? 0 : 1; break; case LPE_OPT_STRING: return (atol (opt->value.string) <= 0) ? 0 : 1; break; } } return -1; } /* * This one is intended to be exported to SLang */ void cfg_core_set_any (char *name, int type, ...) { va_list arglist; va_start (arglist, type); switch (type) { case 0: cfg_core_set_str (name, va_arg (arglist, char *)); break; case 1: cfg_core_set_int (name, va_arg (arglist, long)); break; case 2: cfg_core_set_bool (name, va_arg (arglist, int)); break; } } void cfg_core_destroy (void) { int i; for (i = 0; i < LpeOptionTableSize; i++) { if (LpeOptionTable[i]->type == LPE_OPT_STRING) free (LpeOptionTable[i]->value.string); free (LpeOptionTable[i]); } free (LpeOptionTable); free (LpeOptionHash); LpeOptionHash = NULL; LpeOptionTable = NULL; LpeOptionTableSize = -1; } lpe-1.2.7/src/common.h0000644000175000017500000000032510100312712013434 0ustar adammadamm/* * Copyright (c) 2004 Adam Majer * * This file may be distributed only udner the terms of the GPL license * version 2. See COPYING for further details. */ int copy( const char * from, const char * to ); lpe-1.2.7/src/cfg-core.h0000644000175000017500000000126507314070204013647 0ustar adammadamm/* cfg-core.h * * Copyright (c) 2000 Chris Smith * * Author: * Gergely Nagy * * This file is distributed under the GPL, version 2 or at your option any * later version. See COPYING for details. */ #ifndef LPE_CFG_CORE_H #define LPE_CFG_CORE_H void cfg_core_init ( void ); void cfg_core_destroy ( void ); void cfg_core_set_int ( char *name, long value ); long cfg_core_get_int ( char *name ); void cfg_core_set_str ( char *name, char *value ); char* cfg_core_get_str ( char *name ); void cfg_core_set_bool ( char *name, int value ); int cfg_core_get_bool ( char *name ); void cfg_core_set_any ( char *name, int type, ... ); #endif /* ! LPE_CFG_CORE_H */ lpe-1.2.7/config.guess0000755000175000017500000012546610255441676013571 0ustar adammadamm#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. timestamp='2005-04-22' # 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. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # 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 build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) 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 # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; amd64:OpenBSD:*:*) echo x86_64-unknown-openbsd${UNAME_RELEASE} exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; cats:OpenBSD:*:*) echo arm-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; luna88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; macppc:OpenBSD:*:*) echo powerpc-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 ;; mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mips64-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit 0 ;; macppc:MirBSD:*:*) echo powerppc-unknown-mirbsd${UNAME_RELEASE} exit 0 ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit 0 ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # 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. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | 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-unknown-sysv4 exit 0;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit 0 ;; *:OS400:*:*) echo powerpc-ibm-os400 exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; SR2?01:HI-UX/MPP:*:* | SR8000: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 ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit 0 ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7 && exit 0 ;; esac ;; 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=`(sed 1q /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 ;; # 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 ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${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) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ 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 -o $dummy $dummy.c \ && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && exit 0 echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax 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 ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 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:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${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=${UNAME_VERSION}.${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 BSD 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:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #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 -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then # avoid double evaluation of $set_cc_for_build test -n "$CC_FOR_BUILD" || eval $set_cc_for_build if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) eval $set_cc_for_build 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 -o $dummy $dummy.c && $dummy && exit 0 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:*:* | *3000*: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 ;; 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*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 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/ \ -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/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:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`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*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; x86:Interix*:[34]*) echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' exit 0 ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks 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 i586-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; amd64:CYGWIN*:*:*) echo x86_64-unknown-cygwin 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:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit 0 ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit 0 ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit 0 ;; i*86: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. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #ifdef __INTEL_COMPILER LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) # 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. 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:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit 0 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit 0 ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp 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:[78]*) case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} 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|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^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:*:*:*) # Left here for compatibility: # 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 ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit 0 ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit 0 ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*: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.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-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:*: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 ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit 0 ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos 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 ;; SX-6:SUPER-UX:*:*) echo sx6-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 ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in *86) UNAME_PROCESSOR=i686 ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit 0 ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit 0 ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit 0 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit 0 ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit 0 ;; *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit 0 ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms && exit 0 ;; I*) echo ia64-dec-vms && exit 0 ;; V*) echo vax-dec-vms && exit 0 ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix 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 eval $set_cc_for_build 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) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # 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 -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 # 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 cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: lpe-1.2.7/autogen.sh0000755000175000017500000000770207135112605013230 0ustar adammadamm#!/bin/sh # Run this to generate all the initial makefiles, etc. # Based on autogen.sh found in the macros/ directory of GNOME. DIE=0 if test -z "$srcdir"; then srcdir="." fi (autoconf --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: You must have \`autoconf' installed to compile lpe." echo "Download the appropriate package for your distribution," echo "or get the source tarball from" echo "ftp://ftp.gnu.org/pub/gnu/autoconf/autoconf-2.13.tar.gz" DIE=1 } (grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && { (libtool --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: You must have \`libtool' installed to compile lpe." echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.3.5.tar.gz" echo "(or a newer version if it is available)" DIE=1 } } # We do not depend on gettext. # It is useful to have, but if it isn't present, we don't use it. grep "^AM_GNU_GETTEXT" $srcdir/configure.in >/dev/null && { grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \ (gettext --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Warning**: It is recommended to have \`gettext' installed." echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz" echo "(or a newer version if it is available)" } } (automake --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: You must have \`automake' installed to compile lpe." echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.4.tar.gz" echo "(or a newer version if it is available)" DIE=1 NO_AUTOMAKE=yes } # if no automake, don't bother testing for aclocal test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: Missing \`aclocal'. The version of \`automake'" echo "installed doesn't appear recent enough." echo "Get ftp://ftp.gnu.org/pub/gnu/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 if test -z "$*"; then echo "**Warning**: I am going to run \`configure' with no arguments." echo "If you wish to pass any to it, please specify them on the" echo \`$0\'" command line." echo fi case $CC in xlc ) am_opt=--include-deps;; esac for coin in `find $srcdir -name configure.in -print` do dr=`dirname $coin` if test -f $dr/NO-AUTO-GEN; then echo skipping $dr -- flagged as no auto-gen else echo processing $dr macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin` ( cd $dr aclocalinclude="$ACLOCAL_FLAGS" for k in $macrodirs; do if test -d $k; then aclocalinclude="$aclocalinclude -I $k" ##else ## echo "**Warning**: No such directory \`$k'. Ignored." fi done if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then # if grep "sed.*POTFILES" configure.in >/dev/null; then # : do nothing -- we still have an old unmodified configure.in # else echo "Creating $dr/aclocal.m4 ..." test -r $dr/aclocal.m4 || touch $dr/aclocal.m4 echo "Running gettextize... Ignore non-fatal messages." echo "no" | gettextize --force --copy echo "Making $dr/aclocal.m4 writable ..." test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4 # fi fi if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null && test "x$LIBTOOL" == "x"; then echo "Running libtoolize..." libtoolize --force --copy fi echo "Running aclocal $aclocalinclude ..." aclocal $aclocalinclude if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then echo "Running autoheader..." autoheader fi echo "Running automake --gnu $am_opt ..." automake --add-missing --gnu $am_opt echo "Running autoconf ..." autoconf ) fi done conf_flags="--enable-maintainer-mode" if test x$NOCONFIGURE = x; then echo Running $srcdir/configure $conf_flags "$@" ... $srcdir/configure $conf_flags "$@" \ && echo Now type \`make\' to compile $PKG_NAME || exit 1 else echo Skipping configure process. fi lpe-1.2.7/install-sh0000755000175000017500000001273607075336410013243 0ustar adammadamm#!/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 lpe-1.2.7/BUGS0000644000175000017500000001300107136731120011677 0ustar adammadammBUGS: List of known problems in lpe Items on this list are recognized bugs and will be fixed as soon as I get around to it. There is, however, no time guarantee. ------------------------------------------------------------------------------- - SunOS includes don't properly define PATH_MAX. (priority: high) Apparently there's a different include that should do it. - Screen screws up on non-black background. (priority: high) Reported by travist@qlube.com -- attempting to use lpe on a non-black console with color support does not update non-text areas of the screen. It leaves white bars all over the place. - Seg fault with binaries in module path. (priority: high) On i386/Linux (and probably other ELF platforms, and possibly some non-ELF platforms) add a directory containing binary programs to the module path. These files look like shared libraries and confuse the loader. I'm not sure exactly how the loader gets confused yet... - Syntax highlighting gets corrupted by "yank" command. (priority: medium) Using yank sometimes marks a state as valid when it really isn't... and this causes the syntax highlighter to mess up. If text on the screen is printed in red with a yellow bg, then chances are, this is what happened. Doing any editing before the beginning of the "screwed up" part will fix this, as it will invalidate all the DFA states after the part you edited. I haven't seen this happen in a long time. I'm not dismissing it yet as a bug, but I'd really appreciate it if someone could give me some discrete steps to reproduce it. Or perhaps it was all a bad dream... - Solaris builds fail on intl/libintl.a. (priority: medium) This causes a build error. A second invocation of make is successful, though, so this is reduced to an inconvenience that is ugly and should be fixed some time soon. Until then, the work-around is documented in the README. - Libtool library weirdness screws up mode handling. (priority: medium) The existence of those strange ".la" files confuses the mode searching code and results in some harmless errors to stderr. No big problem, but they can cause some confusion among users and I've gotten several bug reports about it. - Comments badly handled in cppmode and javamode. (priority: medium) Line comments aren't recognized by brace flashing code, so brace flashing can get screwed up by non-matching sets of braces in line comments. - Java syntax highlighting lacks '\uxxxx' support. (priority: medium) The syntax highlighter for Java doesn't know about the \uxxxx style unicode escape sequences. It would be really simple to support these in string constants, but that would be hiding the problem. The real problem is lines like: // this is a \u000A test of unicode escape sequences try\u0050ing try\u002Bing In the first example above, the comment should end at the escape sequence. In the second, 'try' should not be highlighted as a keyword. In the third example try *should* be highlighted as a keyword. Escape sequences should, according to the spec, be translated before lexical scanning and even before comments are removed from the source. In reality, Jikes is the only compiler I've tried that does this correctly... but I would prefer to follow the spec. - Lpe is a bit of a memory hog (priority: low) Lpe represents files internally as a doubly linked list of lines, which means that there is substantial overhead per line of the file. Fixing this completely would require switching to a new storage format, most likely with its own weaknesses. A couple of partial solutions are available here if anyone wants to implement them. The ones I can think of are: * Store the next and prev pointers as an xor of the two, and add fields to the buf_pos structure to hold the current next or prev pointer. This saves one word per line of the file. * Allocate space for the actual text of the line directly after the buf_line structure, letting the buf_line serve as a header. This would save an additional one word per line of a file. It would also really complicate reallocation, since the address of a linked list node would periodically change, invalidating pointers into the linked list. * Change the granularity with which storage is reallocated for a line. This is a trade-off between speed and space, and I haven't seen any really bad memory problems yet, so I'm leaving it at 10 byte intervals. This can easily be changed, as it is a preprocessor constant. * Occasionally decrease the space allocated for a line when its length decreases, especially to zero. Right now, the storage allocated for a line == the maximum length it has been in this editing session. This could be especially helpful for zero-length lines, given their popularity in most programming languages. - Handling for terminal resizes is a little messy (priority: low) Because SLkp_getkey() blocks without interruption even by signals, signals like SIGWINCH don't get handled until the next keystroke. This is really an appearance issue, because the screen is updated as the user begins to do something. For this reason, it's considered a design choice for the moment. If a solution is found that doesn't have harmful side effects then this may change. This problem also presents itself when the application is resumed and it was initially suspended using kill from a separate terminal or kill() from a separate process. This situation is sufficiently rare that I am not going to even think about it. Thus, this issue is named after terminal resizes. lpe-1.2.7/patch0000644000175000017500000000102510327451002012233 0ustar adammadammdiff -u -r lpe-1.2.6.11/src/buffer.c lpe-new/src/buffer.c --- lpe-1.2.6.11/src/buffer.c 2004-07-24 01:00:26.000000000 +0200 +++ lpe-new/src/buffer.c 2005-09-23 01:42:06.000000000 +0200 @@ -550,7 +550,9 @@ */ strcpy(dir, buf->fname); strcpy(file,buf->fname); - sprintf(bakname,"%s/.%s.lpe",dirname(dir),basename(file)); + if ((buf->fname) != NULL) { + snprintf(bakname, sizeof(bakname), "%s.lpe", file); + } if(copy(buf->fname,bakname) != 0) copied = 0; fp = fopen (buf->fname, "w"); lpe-1.2.7/mkinstalldirs0000755000175000017500000000132207075336410014032 0ustar adammadamm#! /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 lpe-1.2.7/config.h.in0000644000175000017500000001142507135315026013251 0ustar adammadamm/* config.h.in. Generated automatically from configure.in by autoheader. */ /* Define if using alloca.c. */ #undef C_ALLOCA /* Define to empty if the keyword does not work. */ #undef const /* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. This function is required for alloca.c support on those systems. */ #undef CRAY_STACKSEG_END /* Define if you have alloca, as a function or macro. */ #undef HAVE_ALLOCA /* Define if you have and it should be used (not on Ultrix). */ #undef HAVE_ALLOCA_H /* Define if you don't have vprintf but do have _doprnt. */ #undef HAVE_DOPRNT /* Define if you have a working `mmap' system call. */ #undef HAVE_MMAP /* Define if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define if you have the vprintf function. */ #undef HAVE_VPRINTF /* Define as __inline if that's what the C compiler calls it. */ #undef inline /* Define to `long' if doesn't define. */ #undef off_t /* Define to `int' if doesn't define. */ #undef pid_t /* Define if you need to in order for stat and other things to work. */ #undef _POSIX_SOURCE /* Define to `unsigned' if doesn't define. */ #undef size_t /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS /* gettext */ #undef ENABLE_NLS #undef HAVE_CATGETS #undef HAVE_GETTEXT #undef HAVE_LC_MESSAGES #undef HAVE_STPCPY /* what to include for slang.h */ #undef SLANG_H /* Define if you have the __argz_count function. */ #undef HAVE___ARGZ_COUNT /* Define if you have the __argz_next function. */ #undef HAVE___ARGZ_NEXT /* Define if you have the __argz_stringify function. */ #undef HAVE___ARGZ_STRINGIFY /* Define if you have the dcgettext function. */ #undef HAVE_DCGETTEXT /* Define if you have the dlopen function. */ #undef HAVE_DLOPEN /* Define if you have the flock function. */ #undef HAVE_FLOCK /* Define if you have the getcwd function. */ #undef HAVE_GETCWD /* Define if you have the getpagesize function. */ #undef HAVE_GETPAGESIZE /* Define if you have the munmap function. */ #undef HAVE_MUNMAP /* Define if you have the putenv function. */ #undef HAVE_PUTENV /* Define if you have the scandir function. */ #undef HAVE_SCANDIR /* Define if you have the setenv function. */ #undef HAVE_SETENV /* Define if you have the setlocale function. */ #undef HAVE_SETLOCALE /* Define if you have the stpcpy function. */ #undef HAVE_STPCPY /* Define if you have the strcasecmp function. */ #undef HAVE_STRCASECMP /* Define if you have the strchr function. */ #undef HAVE_STRCHR /* Define if you have the strcspn function. */ #undef HAVE_STRCSPN /* Define if you have the strdup function. */ #undef HAVE_STRDUP /* Define if you have the strerror function. */ #undef HAVE_STRERROR /* Define if you have the strncasecmp function. */ #undef HAVE_STRNCASECMP /* Define if you have the strstr function. */ #undef HAVE_STRSTR /* Define if you have the strtol function. */ #undef HAVE_STRTOL /* Define if you have the header file. */ #undef HAVE_ARGZ_H /* Define if you have the header file. */ #undef HAVE_DIRENT_H /* Define if you have the header file. */ #undef HAVE_FCNTL_H /* Define if you have the header file. */ #undef HAVE_LIMITS_H /* Define if you have the header file. */ #undef HAVE_LOCALE_H /* Define if you have the header file. */ #undef HAVE_MALLOC_H /* Define if you have the header file. */ #undef HAVE_NDIR_H /* Define if you have the header file. */ #undef HAVE_NL_TYPES_H /* Define if you have the header file. */ #undef HAVE_STRING_H /* Define if you have the header file. */ #undef HAVE_SYS_DIR_H /* Define if you have the header file. */ #undef HAVE_SYS_FILE_H /* Define if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define if you have the header file. */ #undef HAVE_SYS_NDIR_H /* Define if you have the header file. */ #undef HAVE_SYS_PARAM_H /* Define if you have the header file. */ #undef HAVE_SYS_SYSLIMITS_H /* Define if you have the header file. */ #undef HAVE_UNISTD_H /* Define if you have the i library (-li). */ #undef HAVE_LIBI /* Define if you have the intl library (-lintl). */ #undef HAVE_LIBINTL /* Name of package */ #undef PACKAGE /* Version number of package */ #undef VERSION lpe-1.2.7/TODO0000644000175000017500000001124107136735733011726 0ustar adammadammTODO: List of potential improvements in lpe Items in this list are not considered bugs, but would be beneficial changes to make in lpe and are on the back burner. ------------------------------------------------------------------------------- - Make keymaps configurable. (priority: high) Change lpe so that the keymap is not hard-coded into init_slang_keys, but is rather set from configuration options. This allows easier emulation of other text editors from lpe, and allows people to use the editor in ways that make sense to them. - Don't display carriage returns on lines. (priority: medium) There's some code to do this already... I'm thinking about exactly how it is best accomplished. I want to do this right. - Convert all modes' syntax highlighting to one method. (priority: medium) Ack, this is a mess! I do not like it one bit! I need to look over all of my modules and find some standard way to do syntax highlighting -- Right now we have my method cmode, cppmode, and javamode, and Eckehard Berns' method in perlmode, htmlmode, and sgmlmode. And they are very different from each other! This makes changing stuff very hard, because I'm guaranteed to break stuff, and I don't even understand Eckehard's code well enough to easily fix it. - Full screen editing of sed/awk manipulations. (priority: medium) Just a thought. Since I've already designed input.c to allow for multiple open buffers, perhaps I could create an extra full buffer to edit the sed and awk scripts that are used by stream manipulation commands. These could then request sedmode and awkmode by default in set_buf_mode, and it would make applying these sorts of things easier... sort of a meta-visual editor. You could even recursively apply an awk script to a sed script which is then applied to the primary buffer. This would be *very* nice if I obtained a sed, awk, and bourne script mode to go with it. - Change brace flashing. (priority: medium) If and only if syntax highlighting is enabled, instead of actually moving the cursor, I should just use a flash brace color to indicate the matching pair. Then when the cursor is moved over one of a matching pair of braces, I can highlight the pair as well. - Modify mode file format. (priority: medium) Change the modes to export a structure that more flexibly expresses what they can do. This allows version compatibility checks, as well as supporting the linking of static libraries into the executable on platforms that don't support shared libraries. - Color unused keywords differently in Java. (priority: medium) Several of Java's reserved words don't really have a meaning. They are reserved just for the hell of it. These are byvalue, cast, const, future, generic, goto, inner, operator, outer, rest, and var. It would help if I colored them a different color to indicate that their use is always an error. (Maybe even red.) - Update translations. (priority: medium) Most translations of lpe are getting stale. Man pages are not up to date in other languages, and many messages are missing from many languages. - Write custom indentation functions for the various modules. (priority: low) Pretty obvious -- I'll do it when I get time, or I'll integrate it if some one else wants to do it well. This tends to be a hard thing to do well, though, and the attempts I've seen have tended to make things a lot worse rather than better! - Implement at least a few mode-custom keys. (priority: low) Mostly, this needs to be done as an example of how to do it, and so I can get some experience with ease of use of the current interface. Maybe I'll add a key to send a cmode buffer through indent -kr. - Translate to more languages. (priority: low) There are obviously other useful languages that could be supported by lpe. I don't know any of them. This is something that I'll include as more people send me translations -- but it isn't a big deal unless that happens. I've got English, and that's all I'll use anyway. - Support more languages. (priority: low) I also need to rewrite the editor so that it can support unicode editing for languages that can't really be expressed by single-byte characters. This is something to consider for the long term, but not something I have the ability to do right now. - Only load a window of the current file into the buffer. (priority: low) Instead of allocating space for an entire file, it may help with large files to load only a certain section of it. The buffer would note the first and last lines that are loaded, and an attempt to scroll, search, etc beyond those lines would result in loading more of the file from disk. This looks like it'd be a pain to implement, but I'll do so as soon as someone complains about large files in lpe. lpe-1.2.7/AUTHORS0000644000175000017500000000003706737463317012311 0ustar adammadammChris Smith lpe-1.2.7/config.sub0000755000175000017500000007547010255441674013231 0ustar adammadamm#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. timestamp='2005-04-22' # 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. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # 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. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit 0;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; 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 nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) 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 | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb 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. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | msp430 \ | ns16k | ns32k \ | openrisc | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # 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*86 | x86_64) 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. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | msp430-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; # 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 ;; abacus) basic_machine=abacus-unknown ;; 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 ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown 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 ;; c90) basic_machine=c90-cray os=-unicos ;; 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 | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; 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 ;; go32) basic_machine=i386-pc os=-go32 ;; 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*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*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 ;; 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 ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; 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 ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc 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 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; or32 | or32-*) basic_machine=or32-unknown os=-coff ;; os400) basic_machine=powerpc-ibm os=-os400 ;; 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 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-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/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-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 ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; 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 ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; 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 ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sh64) basic_machine=sh64-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b) 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 ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) 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* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -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 ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -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[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -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 ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; 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 ;; or32-*) os=-coff ;; *-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 ;; *-knuth) os=-mmixware ;; *-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 ;; f30[01]-fujitsu | f700-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 ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: lpe-1.2.7/missing0000755000175000017500000002403207751733232012632 0ustar adammadamm#! /bin/sh # Common stub for a few missing GNU programs while installing. # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. # Originally by Fran,cois 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. # 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. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. 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 --run try to run the given command, and emulate it if it fails 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 help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing 0.4 - GNU automake" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. 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_ac}` 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*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 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 ;; autom4te) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi 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. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; 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 ;; help2man) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then # We have makeinfo, but it failed. exit 1 fi 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 ;; tar) shift if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) 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 prerequisites 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 lpe-1.2.7/COPYING0000644000175000017500000004312706737463317012303 0ustar adammadamm GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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. lpe-1.2.7/aclocal.m40000644000175000017500000123103010255441051013056 0ustar adammadamm# generated automatically by aclocal 1.9.5 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005 Free Software Foundation, Inc. # This file 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. # codeset.m4 serial AM1 (gettext-0.10.40) dnl Copyright (C) 2000-2002 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 From Bruno Haible. AC_DEFUN([AM_LANGINFO_CODESET], [ AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, [AC_TRY_LINK([#include ], [char* cs = nl_langinfo(CODESET);], am_cv_langinfo_codeset=yes, am_cv_langinfo_codeset=no) ]) if test $am_cv_langinfo_codeset = yes; then AC_DEFINE(HAVE_LANGINFO_CODESET, 1, [Define if you have and nl_langinfo(CODESET).]) fi ]) # gettext.m4 serial 37 (gettext-0.14.4) dnl Copyright (C) 1995-2005 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 dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1995-2000. dnl Bruno Haible , 2000-2003. dnl Macro to add for using GNU gettext. dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The dnl default (if it is not specified or empty) is 'no-libtool'. dnl INTLSYMBOL should be 'external' for packages with no intl directory, dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. dnl If INTLSYMBOL is 'use-libtool', then a libtool library dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, dnl depending on --{enable,disable}-{shared,static} and on the presence of dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library dnl $(top_builddir)/intl/libintl.a will be created. dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext dnl implementations (in libc or libintl) without the ngettext() function dnl will be ignored. If NEEDSYMBOL is specified and is dnl 'need-formatstring-macros', then GNU gettext implementations that don't dnl support the ISO C 99 formatstring macros will be ignored. dnl INTLDIR is used to find the intl libraries. If empty, dnl the value `$(top_builddir)/intl/' is used. dnl dnl The result of the configuration is one of three cases: dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled dnl and used. dnl Catalog format: GNU --> install in $(datadir) dnl Catalog extension: .mo after installation, .gmo in source tree dnl 2) GNU gettext has been found in the system's C library. dnl Catalog format: GNU --> install in $(datadir) dnl Catalog extension: .mo after installation, .gmo in source tree dnl 3) No internationalization, always use English msgid. dnl Catalog format: none dnl Catalog extension: none dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. dnl The use of .gmo is historical (it was needed to avoid overwriting the dnl GNU format catalogs when building on a platform with an X/Open gettext), dnl but we keep it in order not to force irrelevant filename changes on the dnl maintainers. dnl AC_DEFUN([AM_GNU_GETTEXT], [ dnl Argument checking. ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT ])])])])]) ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT ])])])]) define([gt_included_intl], ifelse([$1], [external], [no], [yes])) define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], [])) AC_REQUIRE([AM_PO_SUBDIRS])dnl ifelse(gt_included_intl, yes, [ AC_REQUIRE([AM_INTL_SUBDIR])dnl ]) dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) dnl Sometimes libintl requires libiconv, so first search for libiconv. dnl Ideally we would do this search only after the dnl if test "$USE_NLS" = "yes"; then dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT dnl the configure script would need to contain the same shell code dnl again, outside any 'if'. There are two solutions: dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not dnl documented, we avoid it. ifelse(gt_included_intl, yes, , [ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) ]) dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation. gt_INTL_MACOSX dnl Set USE_NLS. AM_NLS ifelse(gt_included_intl, yes, [ BUILD_INCLUDED_LIBINTL=no USE_INCLUDED_LIBINTL=no ]) LIBINTL= LTLIBINTL= POSUB= dnl If we use NLS figure out what method if test "$USE_NLS" = "yes"; then gt_use_preinstalled_gnugettext=no ifelse(gt_included_intl, yes, [ AC_MSG_CHECKING([whether included gettext is requested]) AC_ARG_WITH(included-gettext, [ --with-included-gettext use the GNU gettext library included here], nls_cv_force_use_gnu_gettext=$withval, nls_cv_force_use_gnu_gettext=no) AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" if test "$nls_cv_force_use_gnu_gettext" != "yes"; then ]) dnl User does not insist on using GNU NLS library. Figure out what dnl to use. If GNU gettext is available we use this. Else we have dnl to fall back to GNU NLS library. dnl Add a version number to the cache macros. define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1))) define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc]) define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl]) AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, [AC_TRY_LINK([#include ]ifelse([$2], [need-formatstring-macros], [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) #endif changequote(,)dnl typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; changequote([,])dnl ], [])[extern int _nl_msg_cat_cntr; extern int *_nl_domain_bindings;], [bindtextdomain ("", ""); return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], gt_cv_func_gnugettext_libc=yes, gt_cv_func_gnugettext_libc=no)]) if test "$gt_cv_func_gnugettext_libc" != "yes"; then dnl Sometimes libintl requires libiconv, so first search for libiconv. ifelse(gt_included_intl, yes, , [ AM_ICONV_LINK ]) dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) dnl because that would add "-liconv" to LIBINTL and LTLIBINTL dnl even if libiconv doesn't exist. AC_LIB_LINKFLAGS_BODY([intl]) AC_CACHE_CHECK([for GNU gettext in libintl], gt_cv_func_gnugettext_libintl, [gt_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $INCINTL" gt_save_LIBS="$LIBS" LIBS="$LIBS $LIBINTL" dnl Now see whether libintl exists and does not depend on libiconv. AC_TRY_LINK([#include ]ifelse([$2], [need-formatstring-macros], [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) #endif changequote(,)dnl typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; changequote([,])dnl ], [])[extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias (const char *);], [bindtextdomain ("", ""); return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")], gt_cv_func_gnugettext_libintl=yes, gt_cv_func_gnugettext_libintl=no) dnl Now see whether libintl exists and depends on libiconv. if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then LIBS="$LIBS $LIBICONV" AC_TRY_LINK([#include ]ifelse([$2], [need-formatstring-macros], [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) #endif changequote(,)dnl typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; changequote([,])dnl ], [])[extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias (const char *);], [bindtextdomain ("", ""); return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")], [LIBINTL="$LIBINTL $LIBICONV" LTLIBINTL="$LTLIBINTL $LTLIBICONV" gt_cv_func_gnugettext_libintl=yes ]) fi CPPFLAGS="$gt_save_CPPFLAGS" LIBS="$gt_save_LIBS"]) fi dnl If an already present or preinstalled GNU gettext() is found, dnl use it. But if this macro is used in GNU gettext, and GNU dnl gettext is already preinstalled in libintl, we update this dnl libintl. (Cf. the install rule in intl/Makefile.in.) if test "$gt_cv_func_gnugettext_libc" = "yes" \ || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ && test "$PACKAGE" != gettext-runtime \ && test "$PACKAGE" != gettext-tools; }; then gt_use_preinstalled_gnugettext=yes else dnl Reset the values set by searching for libintl. LIBINTL= LTLIBINTL= INCINTL= fi ifelse(gt_included_intl, yes, [ if test "$gt_use_preinstalled_gnugettext" != "yes"; then dnl GNU gettext is not found in the C library. dnl Fall back on included GNU gettext library. nls_cv_use_gnu_gettext=yes fi fi if test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Mark actions used to generate GNU NLS library. BUILD_INCLUDED_LIBINTL=yes USE_INCLUDED_LIBINTL=yes LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV" LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` fi CATOBJEXT= if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Mark actions to use GNU gettext tools. CATOBJEXT=.gmo fi ]) if test -n "$INTL_MACOSX_LIBS"; then if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Some extra flags are needed during linking. LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" fi fi if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if translation of program messages to the user's native language is requested.]) else USE_NLS=no fi fi AC_MSG_CHECKING([whether to use NLS]) AC_MSG_RESULT([$USE_NLS]) if test "$USE_NLS" = "yes"; then AC_MSG_CHECKING([where the gettext function comes from]) if test "$gt_use_preinstalled_gnugettext" = "yes"; then if test "$gt_cv_func_gnugettext_libintl" = "yes"; then gt_source="external libintl" else gt_source="libc" fi else gt_source="included intl directory" fi AC_MSG_RESULT([$gt_source]) fi if test "$USE_NLS" = "yes"; then if test "$gt_use_preinstalled_gnugettext" = "yes"; then if test "$gt_cv_func_gnugettext_libintl" = "yes"; then AC_MSG_CHECKING([how to link with libintl]) AC_MSG_RESULT([$LIBINTL]) AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) fi dnl For backward compatibility. Some packages may be using this. AC_DEFINE(HAVE_GETTEXT, 1, [Define if the GNU gettext() function is already present or preinstalled.]) AC_DEFINE(HAVE_DCGETTEXT, 1, [Define if the GNU dcgettext() function is already present or preinstalled.]) fi dnl We need to process the po/ directory. POSUB=po fi ifelse(gt_included_intl, yes, [ dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL dnl to 'yes' because some of the testsuite requires it. if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then BUILD_INCLUDED_LIBINTL=yes fi dnl Make all variables we use known to autoconf. AC_SUBST(BUILD_INCLUDED_LIBINTL) AC_SUBST(USE_INCLUDED_LIBINTL) AC_SUBST(CATOBJEXT) dnl For backward compatibility. Some configure.ins may be using this. nls_cv_header_intl= nls_cv_header_libgt= dnl For backward compatibility. Some Makefiles may be using this. DATADIRNAME=share AC_SUBST(DATADIRNAME) dnl For backward compatibility. Some Makefiles may be using this. INSTOBJEXT=.mo AC_SUBST(INSTOBJEXT) dnl For backward compatibility. Some Makefiles may be using this. GENCAT=gencat AC_SUBST(GENCAT) dnl For backward compatibility. Some Makefiles may be using this. INTLOBJS= if test "$USE_INCLUDED_LIBINTL" = yes; then INTLOBJS="\$(GETTOBJS)" fi AC_SUBST(INTLOBJS) dnl Enable libtool support if the surrounding package wishes it. INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) ]) dnl For backward compatibility. Some Makefiles may be using this. INTLLIBS="$LIBINTL" AC_SUBST(INTLLIBS) dnl Make all documented variables known to autoconf. AC_SUBST(LIBINTL) AC_SUBST(LTLIBINTL) AC_SUBST(POSUB) ]) dnl Checks for all prerequisites of the intl subdirectory, dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. AC_DEFUN([AM_INTL_SUBDIR], [ AC_REQUIRE([AC_PROG_INSTALL])dnl AC_REQUIRE([AM_MKINSTALLDIRS])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([gt_GLIBC2])dnl AC_REQUIRE([AC_PROG_RANLIB])dnl AC_REQUIRE([AC_ISC_POSIX])dnl AC_REQUIRE([AC_HEADER_STDC])dnl AC_REQUIRE([AC_C_CONST])dnl AC_REQUIRE([bh_C_SIGNED])dnl AC_REQUIRE([AC_C_INLINE])dnl AC_REQUIRE([AC_TYPE_OFF_T])dnl AC_REQUIRE([AC_TYPE_SIZE_T])dnl AC_REQUIRE([gl_AC_TYPE_LONG_LONG])dnl AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl AC_REQUIRE([gt_TYPE_WCHAR_T])dnl AC_REQUIRE([gt_TYPE_WINT_T])dnl AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) AC_REQUIRE([gl_AC_HEADER_STDINT_H]) AC_REQUIRE([gt_TYPE_INTMAX_T]) AC_REQUIRE([gt_PRINTF_POSIX]) AC_REQUIRE([AC_FUNC_ALLOCA])dnl AC_REQUIRE([AC_FUNC_MMAP])dnl AC_REQUIRE([gl_GLIBC21])dnl AC_REQUIRE([gt_INTDIV0])dnl AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])dnl AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl AC_REQUIRE([gt_INTTYPES_PRI])dnl AC_REQUIRE([gl_XSIZE])dnl AC_REQUIRE([gt_INTL_MACOSX])dnl AC_CHECK_TYPE([ptrdiff_t], , [AC_DEFINE([ptrdiff_t], [long], [Define as the type of the result of subtracting two pointers, if the system doesn't define it.]) ]) AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ stdlib.h string.h unistd.h sys/param.h]) AC_CHECK_FUNCS([asprintf fwprintf getcwd getegid geteuid getgid getuid \ mempcpy munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup \ strtoul tsearch wcslen __argz_count __argz_stringify __argz_next \ __fsetlocking]) dnl Use the _snprintf function only if it is declared (because on NetBSD it dnl is defined as a weak alias of snprintf; we prefer to use the latter). gt_CHECK_DECL(_snprintf, [#include ]) gt_CHECK_DECL(_snwprintf, [#include ]) dnl Use the *_unlocked functions only if they are declared. dnl (because some of them were defined without being declared in Solaris dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built dnl on Solaris 2.5.1 to run on Solaris 2.6). dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13. gt_CHECK_DECL(feof_unlocked, [#include ]) gt_CHECK_DECL(fgets_unlocked, [#include ]) gt_CHECK_DECL(getc_unlocked, [#include ]) case $gt_cv_func_printf_posix in *yes) HAVE_POSIX_PRINTF=1 ;; *) HAVE_POSIX_PRINTF=0 ;; esac AC_SUBST([HAVE_POSIX_PRINTF]) if test "$ac_cv_func_asprintf" = yes; then HAVE_ASPRINTF=1 else HAVE_ASPRINTF=0 fi AC_SUBST([HAVE_ASPRINTF]) if test "$ac_cv_func_snprintf" = yes; then HAVE_SNPRINTF=1 else HAVE_SNPRINTF=0 fi AC_SUBST([HAVE_SNPRINTF]) if test "$ac_cv_func_wprintf" = yes; then HAVE_WPRINTF=1 else HAVE_WPRINTF=0 fi AC_SUBST([HAVE_WPRINTF]) AM_ICONV AM_LANGINFO_CODESET if test $ac_cv_header_locale_h = yes; then gt_LC_MESSAGES fi if test -n "$INTL_MACOSX_LIBS"; then CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" fi dnl intl/plural.c is generated from intl/plural.y. It requires bison, dnl because plural.y uses bison specific features. It requires at least dnl bison-1.26 because earlier versions generate a plural.c that doesn't dnl compile. dnl bison is only needed for the maintainer (who touches plural.y). But in dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put dnl the rule in general Makefile. Now, some people carelessly touch the dnl files or have a broken "make" program, hence the plural.c rule will dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not dnl present or too old. AC_CHECK_PROGS([INTLBISON], [bison]) if test -z "$INTLBISON"; then ac_verc_fail=yes else dnl Found it, now check the version. AC_MSG_CHECKING([version of bison]) changequote(<<,>>)dnl ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) changequote([,])dnl ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; esac AC_MSG_RESULT([$ac_prog_version]) fi if test $ac_verc_fail = yes; then INTLBISON=: fi ]) dnl Checks for special options needed on MacOS X. dnl Defines INTL_MACOSX_LIBS. AC_DEFUN([gt_INTL_MACOSX], [ dnl Check for API introduced in MacOS X 10.2. AC_CACHE_CHECK([for CFPreferencesCopyAppValue], gt_cv_func_CFPreferencesCopyAppValue, [gt_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" gt_save_LIBS="$LIBS" LIBS="$LIBS -framework CoreFoundation" AC_TRY_LINK([#include ], [CFPreferencesCopyAppValue(NULL, NULL)], [gt_cv_func_CFPreferencesCopyAppValue=yes], [gt_cv_func_CFPreferencesCopyAppValue=no]) CPPFLAGS="$gt_save_CPPFLAGS" LIBS="$gt_save_LIBS"]) if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1, [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) fi dnl Check for API introduced in MacOS X 10.3. AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent, [gt_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" gt_save_LIBS="$LIBS" LIBS="$LIBS -framework CoreFoundation" AC_TRY_LINK([#include ], [CFLocaleCopyCurrent();], [gt_cv_func_CFLocaleCopyCurrent=yes], [gt_cv_func_CFLocaleCopyCurrent=no]) CPPFLAGS="$gt_save_CPPFLAGS" LIBS="$gt_save_LIBS"]) if test $gt_cv_func_CFLocaleCopyCurrent = yes; then AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1, [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) fi INTL_MACOSX_LIBS= if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" fi AC_SUBST([INTL_MACOSX_LIBS]) ]) dnl gt_CHECK_DECL(FUNC, INCLUDES) dnl Check whether a function is declared. AC_DEFUN([gt_CHECK_DECL], [ AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1, [AC_TRY_COMPILE([$2], [ #ifndef $1 char *p = (char *) $1; #endif ], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)]) if test $ac_cv_have_decl_$1 = yes; then gt_value=1 else gt_value=0 fi AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value], [Define to 1 if you have the declaration of `$1', and to 0 if you don't.]) ]) dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) # glibc2.m4 serial 1 dnl Copyright (C) 2000-2002, 2004 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. # Test for the GNU C Library, version 2.0 or newer. # From Bruno Haible. AC_DEFUN([gt_GLIBC2], [ AC_CACHE_CHECK(whether we are using the GNU C Library 2 or newer, ac_cv_gnu_library_2, [AC_EGREP_CPP([Lucky GNU user], [ #include #ifdef __GNU_LIBRARY__ #if (__GLIBC__ >= 2) Lucky GNU user #endif #endif ], ac_cv_gnu_library_2=yes, ac_cv_gnu_library_2=no) ] ) AC_SUBST(GLIBC2) GLIBC2="$ac_cv_gnu_library_2" ] ) # glibc21.m4 serial 3 dnl Copyright (C) 2000-2002, 2004 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. # Test for the GNU C Library, version 2.1 or newer. # From Bruno Haible. AC_DEFUN([gl_GLIBC21], [ AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, ac_cv_gnu_library_2_1, [AC_EGREP_CPP([Lucky GNU user], [ #include #ifdef __GNU_LIBRARY__ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) Lucky GNU user #endif #endif ], ac_cv_gnu_library_2_1=yes, ac_cv_gnu_library_2_1=no) ] ) AC_SUBST(GLIBC21) GLIBC21="$ac_cv_gnu_library_2_1" ] ) # iconv.m4 serial AM4 (gettext-0.11.3) dnl Copyright (C) 2000-2002 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 From Bruno Haible. AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], [ dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV dnl accordingly. AC_LIB_LINKFLAGS_BODY([iconv]) ]) AC_DEFUN([AM_ICONV_LINK], [ dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and dnl those with the standalone portable GNU libiconv installed). dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV dnl accordingly. AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) dnl Add $INCICONV to CPPFLAGS before performing the following checks, dnl because if the user has installed libiconv and not disabled its use dnl via --without-libiconv-prefix, he wants to use it. The first dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. am_save_CPPFLAGS="$CPPFLAGS" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no AC_TRY_LINK([#include #include ], [iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);], am_cv_func_iconv=yes) if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" LIBS="$LIBS $LIBICONV" AC_TRY_LINK([#include #include ], [iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);], am_cv_lib_iconv=yes am_cv_func_iconv=yes) LIBS="$am_save_LIBS" fi ]) if test "$am_cv_func_iconv" = yes; then AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) fi if test "$am_cv_lib_iconv" = yes; then AC_MSG_CHECKING([how to link with libiconv]) AC_MSG_RESULT([$LIBICONV]) else dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV dnl either. CPPFLAGS="$am_save_CPPFLAGS" LIBICONV= LTLIBICONV= fi AC_SUBST(LIBICONV) AC_SUBST(LTLIBICONV) ]) AC_DEFUN([AM_ICONV], [ AM_ICONV_LINK if test "$am_cv_func_iconv" = yes; then AC_MSG_CHECKING([for iconv declaration]) AC_CACHE_VAL(am_cv_proto_iconv, [ AC_TRY_COMPILE([ #include #include extern #ifdef __cplusplus "C" #endif #if defined(__STDC__) || defined(__cplusplus) size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); #else size_t iconv(); #endif ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` AC_MSG_RESULT([$]{ac_t:- }[$]am_cv_proto_iconv) AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, [Define as const if the declaration of iconv() needs const.]) fi ]) # intdiv0.m4 serial 1 (gettext-0.11.3) dnl Copyright (C) 2002 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 From Bruno Haible. AC_DEFUN([gt_INTDIV0], [ AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_CACHE_CHECK([whether integer division by zero raises SIGFPE], gt_cv_int_divbyzero_sigfpe, [ AC_TRY_RUN([ #include #include static void #ifdef __cplusplus sigfpe_handler (int sig) #else sigfpe_handler (sig) int sig; #endif { /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ exit (sig != SIGFPE); } int x = 1; int y = 0; int z; int nan; int main () { signal (SIGFPE, sigfpe_handler); /* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ #if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) signal (SIGTRAP, sigfpe_handler); #endif /* Linux/SPARC yields signal SIGILL. */ #if defined (__sparc__) && defined (__linux__) signal (SIGILL, sigfpe_handler); #endif z = x / y; nan = y / y; exit (1); } ], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no, [ # Guess based on the CPU. case "$host_cpu" in alpha* | i[34567]86 | m68k | s390*) gt_cv_int_divbyzero_sigfpe="guessing yes";; *) gt_cv_int_divbyzero_sigfpe="guessing no";; esac ]) ]) case "$gt_cv_int_divbyzero_sigfpe" in *yes) value=1;; *) value=0;; esac AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value, [Define if integer division by zero raises signal SIGFPE.]) ]) # intmax.m4 serial 2 (gettext-0.14.2) dnl Copyright (C) 2002-2005 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 From Bruno Haible. dnl Test whether the system has the 'intmax_t' type, but don't attempt to dnl find a replacement if it is lacking. AC_DEFUN([gt_TYPE_INTMAX_T], [ AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) AC_REQUIRE([gl_AC_HEADER_STDINT_H]) AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t, [AC_TRY_COMPILE([ #include #include #if HAVE_STDINT_H_WITH_UINTMAX #include #endif #if HAVE_INTTYPES_H_WITH_UINTMAX #include #endif ], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)]) if test $gt_cv_c_intmax_t = yes; then AC_DEFINE(HAVE_INTMAX_T, 1, [Define if you have the 'intmax_t' type in or .]) fi ]) # inttypes-pri.m4 serial 1 (gettext-0.11.4) dnl Copyright (C) 1997-2002 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 From Bruno Haible. # Define PRI_MACROS_BROKEN if exists and defines the PRI* # macros to non-string values. This is the case on AIX 4.3.3. AC_DEFUN([gt_INTTYPES_PRI], [ AC_REQUIRE([gt_HEADER_INTTYPES_H]) if test $gt_cv_header_inttypes_h = yes; then AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], gt_cv_inttypes_pri_broken, [ AC_TRY_COMPILE([#include #ifdef PRId32 char *p = PRId32; #endif ], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes) ]) fi if test "$gt_cv_inttypes_pri_broken" = yes; then AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1, [Define if exists and defines unusable PRI* macros.]) fi ]) # inttypes.m4 serial 1 (gettext-0.11.4) dnl Copyright (C) 1997-2002 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 From Paul Eggert. # Define HAVE_INTTYPES_H if exists and doesn't clash with # . AC_DEFUN([gt_HEADER_INTTYPES_H], [ AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h, [ AC_TRY_COMPILE( [#include #include ], [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no) ]) if test $gt_cv_header_inttypes_h = yes; then AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1, [Define if exists and doesn't clash with .]) fi ]) # inttypes_h.m4 serial 6 dnl Copyright (C) 1997-2004 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 From Paul Eggert. # Define HAVE_INTTYPES_H_WITH_UINTMAX if exists, # doesn't clash with , and declares uintmax_t. AC_DEFUN([gl_AC_HEADER_INTTYPES_H], [ AC_CACHE_CHECK([for inttypes.h], gl_cv_header_inttypes_h, [AC_TRY_COMPILE( [#include #include ], [uintmax_t i = (uintmax_t) -1;], gl_cv_header_inttypes_h=yes, gl_cv_header_inttypes_h=no)]) if test $gl_cv_header_inttypes_h = yes; then AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1, [Define if exists, doesn't clash with , and declares uintmax_t. ]) fi ]) # lcmessage.m4 serial 4 (gettext-0.14.2) dnl Copyright (C) 1995-2002, 2004-2005 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 dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1995. # Check whether LC_MESSAGES is available in . AC_DEFUN([gt_LC_MESSAGES], [ AC_CACHE_CHECK([for LC_MESSAGES], gt_cv_val_LC_MESSAGES, [AC_TRY_LINK([#include ], [return LC_MESSAGES], gt_cv_val_LC_MESSAGES=yes, gt_cv_val_LC_MESSAGES=no)]) if test $gt_cv_val_LC_MESSAGES = yes; then AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your file defines LC_MESSAGES.]) fi ]) # lib-ld.m4 serial 3 (gettext-0.13) dnl Copyright (C) 1996-2003 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 Subroutines of libtool.m4, dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision dnl with libtool.m4. dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. AC_DEFUN([AC_LIB_PROG_LD_GNU], [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, [# I'd rather use --version here, but apparently some GNU ld's only accept -v. case `$LD -v 2>&1 conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by GCC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac 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 AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(acl_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 acl_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. case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in *GNU* | *'with BFD'*) test "$with_gnu_ld" != no && break ;; *) test "$with_gnu_ld" != yes && break ;; esac fi done IFS="$ac_save_ifs" else acl_cv_path_LD="$LD" # Let the user override the test with a path. fi]) LD="$acl_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_LIB_PROG_LD_GNU ]) # lib-link.m4 serial 6 (gettext-0.14.3) dnl Copyright (C) 2001-2005 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 From Bruno Haible. AC_PREREQ(2.50) dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and dnl the libraries corresponding to explicit and implicit dependencies. dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and dnl augments the CPPFLAGS variable. AC_DEFUN([AC_LIB_LINKFLAGS], [ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) define([Name],[translit([$1],[./-], [___])]) define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ AC_LIB_LINKFLAGS_BODY([$1], [$2]) ac_cv_lib[]Name[]_libs="$LIB[]NAME" ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" ac_cv_lib[]Name[]_cppflags="$INC[]NAME" ]) LIB[]NAME="$ac_cv_lib[]Name[]_libs" LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" INC[]NAME="$ac_cv_lib[]Name[]_cppflags" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) AC_SUBST([LIB]NAME) AC_SUBST([LTLIB]NAME) dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the dnl results of this search when this library appears as a dependency. HAVE_LIB[]NAME=yes undefine([Name]) undefine([NAME]) ]) dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) dnl searches for libname and the libraries corresponding to explicit and dnl implicit dependencies, together with the specified include files and dnl the ability to compile and link the specified testcode. If found, it dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], [ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) define([Name],[translit([$1],[./-], [___])]) define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME dnl accordingly. AC_LIB_LINKFLAGS_BODY([$1], [$2]) dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, dnl because if the user has installed lib[]Name and not disabled its use dnl via --without-lib[]Name-prefix, he wants to use it. ac_save_CPPFLAGS="$CPPFLAGS" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ ac_save_LIBS="$LIBS" LIBS="$LIBS $LIB[]NAME" AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) LIBS="$ac_save_LIBS" ]) if test "$ac_cv_lib[]Name" = yes; then HAVE_LIB[]NAME=yes AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) AC_MSG_CHECKING([how to link with lib[]$1]) AC_MSG_RESULT([$LIB[]NAME]) else HAVE_LIB[]NAME=no dnl If $LIB[]NAME didn't lead to a usable library, we don't need dnl $INC[]NAME either. CPPFLAGS="$ac_save_CPPFLAGS" LIB[]NAME= LTLIB[]NAME= fi AC_SUBST([HAVE_LIB]NAME) AC_SUBST([LIB]NAME) AC_SUBST([LTLIB]NAME) undefine([Name]) undefine([NAME]) ]) dnl Determine the platform dependent parameters needed to use rpath: dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, dnl hardcode_direct, hardcode_minus_L. AC_DEFUN([AC_LIB_RPATH], [ dnl Tell automake >= 1.10 to complain if config.rpath is missing. m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh . ./conftest.sh rm -f ./conftest.sh acl_cv_rpath=done ]) wl="$acl_cv_wl" libext="$acl_cv_libext" shlibext="$acl_cv_shlibext" hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" hardcode_direct="$acl_cv_hardcode_direct" hardcode_minus_L="$acl_cv_hardcode_minus_L" dnl Determine whether the user wants rpath handling at all. AC_ARG_ENABLE(rpath, [ --disable-rpath do not hardcode runtime library paths], :, enable_rpath=yes) ]) dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and dnl the libraries corresponding to explicit and implicit dependencies. dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. AC_DEFUN([AC_LIB_LINKFLAGS_BODY], [ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) AC_LIB_ARG_WITH([lib$1-prefix], [ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib --without-lib$1-prefix don't search for lib$1 in includedir and libdir], [ if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) else additional_includedir="$withval/include" additional_libdir="$withval/lib" fi fi ]) dnl Search the library and its dependencies in $additional_libdir and dnl $LDFLAGS. Using breadth-first-seach. LIB[]NAME= LTLIB[]NAME= INC[]NAME= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='$1 $2' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" dnl See if it was already located by an earlier AC_LIB_LINKFLAGS dnl or AC_LIB_HAVE_LINKFLAGS call. uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" else dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined dnl that this library doesn't exist. So just drop it. : fi else dnl Search the library lib$name in $additional_libdir and $LDFLAGS dnl and the already constructed $LIBNAME/$LTLIBNAME. found_dir= found_la= found_so= found_a= if test $use_additional = yes; then if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then found_dir="$additional_libdir" found_so="$additional_libdir/lib$name.$shlibext" if test -f "$additional_libdir/lib$name.la"; then found_la="$additional_libdir/lib$name.la" fi else if test -f "$additional_libdir/lib$name.$libext"; then found_dir="$additional_libdir" found_a="$additional_libdir/lib$name.$libext" if test -f "$additional_libdir/lib$name.la"; then found_la="$additional_libdir/lib$name.la" fi fi fi fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then found_dir="$dir" found_so="$dir/lib$name.$shlibext" if test -f "$dir/lib$name.la"; then found_la="$dir/lib$name.la" fi else if test -f "$dir/lib$name.$libext"; then found_dir="$dir" found_a="$dir/lib$name.$libext" if test -f "$dir/lib$name.la"; then found_la="$dir/lib$name.la" fi fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then dnl Found the library. LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then dnl Linking with a shared library. We attempt to hardcode its dnl directory into the executable's runpath, unless it's the dnl standard /usr/lib. if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then dnl No hardcoding is needed. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else dnl Use an explicit option to hardcode DIR into the resulting dnl binary. dnl Potentially add DIR to ltrpathdirs. dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi dnl The hardcoding into $LIBNAME is system dependent. if test "$hardcode_direct" = yes; then dnl Using DIR/libNAME.so during linking hardcodes DIR into the dnl resulting binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then dnl Use an explicit option to hardcode DIR into the resulting dnl binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" dnl Potentially add DIR to rpathdirs. dnl The rpathdirs will be appended to $LIBNAME at the end. haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else dnl Rely on "-L$found_dir". dnl But don't add it if it's already contained in the LDFLAGS dnl or the already constructed $LIBNAME haveit= for x in $LDFLAGS $LIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" fi if test "$hardcode_minus_L" != no; then dnl FIXME: Not sure whether we should use dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" dnl here. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH dnl here, because this doesn't fit in flags passed to the dnl compiler. So give up. No hardcoding. This affects only dnl very old systems. dnl FIXME: Not sure whether we should use dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" dnl here. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then dnl Linking with a static library. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" else dnl We shouldn't come here, but anyway it's good to have a dnl fallback. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" fi fi dnl Assume the include files are nearby. additional_includedir= case "$found_dir" in */lib | */lib/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then dnl Potentially add $additional_includedir to $INCNAME. dnl But don't add it dnl 1. if it's the standard /usr/include, dnl 2. if it's /usr/local/include and we are using GCC on Linux, dnl 3. if it's already present in $CPPFLAGS or the already dnl constructed $INCNAME, dnl 4. if it doesn't exist as a directory. if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INC[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then dnl Really add $additional_includedir to $INCNAME. INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" fi fi fi fi fi dnl Look for dependencies. if test -n "$found_la"; then dnl Read the .la file. It defines the variables dnl dlname, library_names, old_library, dependency_libs, current, dnl age, revision, installed, dlopen, dlpreopen, libdir. save_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$save_libdir" dnl We use only dependency_libs. for dep in $dependency_libs; do case "$dep" in -L*) additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. dnl But don't add it dnl 1. if it's the standard /usr/lib, dnl 2. if it's /usr/local/lib and we are using GCC on Linux, dnl 3. if it's already present in $LDFLAGS or the already dnl constructed $LIBNAME, dnl 4. if it doesn't exist as a directory. if test "X$additional_libdir" != "X/usr/lib"; then haveit= if test "X$additional_libdir" = "X/usr/local/lib"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LIBNAME. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" fi fi haveit= for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LTLIBNAME. LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then dnl Potentially add DIR to rpathdirs. dnl The rpathdirs will be appended to $LIBNAME at the end. haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi dnl Potentially add DIR to ltrpathdirs. dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) dnl Handle this in the next round. names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` ;; *.la) dnl Handle this in the next round. Throw away the .la's dnl directory; it is already contained in a preceding -L dnl option. names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) dnl Most likely an immediate library name. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" ;; esac done fi else dnl Didn't find the library; assume it is in the system directories dnl known to the linker and runtime loader. (All the system dnl directories known to the linker should also be known to the dnl runtime loader, otherwise the system is severely misconfigured.) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$hardcode_libdir_separator"; then dnl Weird platform: only the last -rpath option counts, the user must dnl pass all path elements in one option. We can arrange that for a dnl single library, but not when more than one $LIBNAMEs are used. alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" done dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" else dnl The -rpath options are cumulative. for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then dnl When using libtool, the option that works for both libraries and dnl executables is -R. The -R options are cumulative. for found_dir in $ltrpathdirs; do LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" done fi ]) dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, dnl unless already present in VAR. dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes dnl contains two or three consecutive elements that belong together. AC_DEFUN([AC_LIB_APPENDTOVAR], [ for element in [$2]; do haveit= for x in $[$1]; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then [$1]="${[$1]}${[$1]:+ }$element" fi done ]) # lib-prefix.m4 serial 4 (gettext-0.14.2) dnl Copyright (C) 2001-2005 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 From Bruno Haible. dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't dnl require excessive bracketing. ifdef([AC_HELP_STRING], [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], [AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed dnl to access previously installed libraries. The basic assumption is that dnl a user will want packages to use other packages he previously installed dnl with the same --prefix option. dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate dnl libraries, but is otherwise very convenient. AC_DEFUN([AC_LIB_PREFIX], [ AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) AC_LIB_ARG_WITH([lib-prefix], [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib --without-lib-prefix don't search for libraries in includedir and libdir], [ if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) else additional_includedir="$withval/include" additional_libdir="$withval/lib" fi fi ]) if test $use_additional = yes; then dnl Potentially add $additional_includedir to $CPPFLAGS. dnl But don't add it dnl 1. if it's the standard /usr/include, dnl 2. if it's already present in $CPPFLAGS, dnl 3. if it's /usr/local/include and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. if test "X$additional_includedir" != "X/usr/include"; then haveit= for x in $CPPFLAGS; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then if test -d "$additional_includedir"; then dnl Really add $additional_includedir to $CPPFLAGS. CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" fi fi fi fi dnl Potentially add $additional_libdir to $LDFLAGS. dnl But don't add it dnl 1. if it's the standard /usr/lib, dnl 2. if it's already present in $LDFLAGS, dnl 3. if it's /usr/local/lib and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. if test "X$additional_libdir" != "X/usr/lib"; then haveit= for x in $LDFLAGS; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test "X$additional_libdir" = "X/usr/local/lib"; then if test -n "$GCC"; then case $host_os in linux*) haveit=yes;; esac fi fi if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LDFLAGS. LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" fi fi fi fi fi ]) dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, dnl acl_final_exec_prefix, containing the values to which $prefix and dnl $exec_prefix will expand at the end of the configure script. AC_DEFUN([AC_LIB_PREPARE_PREFIX], [ dnl Unfortunately, prefix and exec_prefix get only finally determined dnl at the end of configure. if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" else acl_final_prefix="$prefix" fi if test "X$exec_prefix" = "XNONE"; then acl_final_exec_prefix='${prefix}' else acl_final_exec_prefix="$exec_prefix" fi acl_save_prefix="$prefix" prefix="$acl_final_prefix" eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" prefix="$acl_save_prefix" ]) dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the dnl variables prefix and exec_prefix bound to the values they will have dnl at the end of the configure script. AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], [ acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" $1 exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" ]) # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # serial 47 AC_PROG_LIBTOOL # Debian $Rev: 214 $ # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) # ----------------------------------------------------------- # If this macro is not defined by Autoconf, define it here. m4_ifdef([AC_PROVIDE_IFELSE], [], [m4_define([AC_PROVIDE_IFELSE], [m4_ifdef([AC_PROVIDE_$1], [$2], [$3])])]) # AC_PROG_LIBTOOL # --------------- AC_DEFUN([AC_PROG_LIBTOOL], [AC_REQUIRE([_AC_PROG_LIBTOOL])dnl dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. AC_PROVIDE_IFELSE([AC_PROG_CXX], [AC_LIBTOOL_CXX], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX ])]) dnl And a similar setup for Fortran 77 support AC_PROVIDE_IFELSE([AC_PROG_F77], [AC_LIBTOOL_F77], [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 ])]) dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [AC_LIBTOOL_GCJ], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [AC_LIBTOOL_GCJ], [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], [AC_LIBTOOL_GCJ], [ifdef([AC_PROG_GCJ], [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) ifdef([A][M_PROG_GCJ], [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) ifdef([LT_AC_PROG_GCJ], [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) ])])# AC_PROG_LIBTOOL # _AC_PROG_LIBTOOL # ---------------- AC_DEFUN([_AC_PROG_LIBTOOL], [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl # Prevent multiple expansion define([AC_PROG_LIBTOOL], []) ])# _AC_PROG_LIBTOOL # AC_LIBTOOL_SETUP # ---------------- AC_DEFUN([AC_LIBTOOL_SETUP], [AC_PREREQ(2.50)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_CC])dnl AC_REQUIRE([AC_PROG_LD])dnl AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl AC_REQUIRE([AC_PROG_NM])dnl AC_REQUIRE([AC_PROG_LN_S])dnl AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! AC_REQUIRE([AC_OBJEXT])dnl AC_REQUIRE([AC_EXEEXT])dnl dnl AC_LIBTOOL_SYS_MAX_CMD_LEN AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE AC_LIBTOOL_OBJDIR AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl _LT_AC_PROG_ECHO_BACKSLASH 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 "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # 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' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' # Constants: rm="rm -f" # Global variables: default_ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except M$VC, # which needs '.lib'). libext=a ltmain="$ac_aux_dir/ltmain.sh" ofile="$default_ofile" with_gnu_ld="$lt_cv_prog_gnu_ld" AC_CHECK_TOOL(AR, ar, false) AC_CHECK_TOOL(RANLIB, ranlib, :) AC_CHECK_TOOL(STRIP, strip, :) old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" test -z "$MAGIC_CMD" && MAGIC_CMD=file test -z "$NM" && NM=nm test -z "$SED" && SED=sed test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$RANLIB" && RANLIB=: test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" ;; *) old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then AC_PATH_MAGIC fi ;; esac AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], enable_win32_dll=yes, enable_win32_dll=no) AC_ARG_ENABLE([libtool-lock], [AC_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes AC_ARG_WITH([pic], [AC_HELP_STRING([--with-pic], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [pic_mode="$withval"], [pic_mode=default]) test -z "$pic_mode" && pic_mode=default # Use C for the default configuration in the libtool script tagname= AC_LIBTOOL_LANG_C_CONFIG _LT_AC_TAGCONFIG ])# AC_LIBTOOL_SETUP # _LT_AC_SYS_COMPILER # ------------------- AC_DEFUN([_LT_AC_SYS_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_AC_SYS_COMPILER # _LT_AC_SYS_LIBPATH_AIX # ---------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], [AC_LINK_IFELSE(AC_LANG_PROGRAM,[ aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi],[]) if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ])# _LT_AC_SYS_LIBPATH_AIX # _LT_AC_SHELL_INIT(ARG) # ---------------------- AC_DEFUN([_LT_AC_SHELL_INIT], [ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], [AC_DIVERT_PUSH(NOTICE)]) $1 AC_DIVERT_POP ])# _LT_AC_SHELL_INIT # _LT_AC_PROG_ECHO_BACKSLASH # -------------------------- # Add some code to the start of the generated configure script which # will find an echo command which doesn't interpret backslashes. AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], [_LT_AC_SHELL_INIT([ # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` ;; esac echo=${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 && 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' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # 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. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$dir/echo" break fi done IFS="$lt_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' && echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "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 configure 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' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "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 echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "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-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} else # Oops. We lost completely, so just stick with echo. echo=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. ECHO=$echo if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" fi AC_SUBST(ECHO) ])])# _LT_AC_PROG_ECHO_BACKSLASH # _LT_AC_LOCK # ----------- AC_DEFUN([_LT_AC_LOCK], [AC_ARG_ENABLE([libtool-lock], [AC_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line __oline__ "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case "`/usr/bin/file conftest.o`" in *32-bit*) case $host in x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; 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_PUSH(C) AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) 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 ;; AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], [*-*-cygwin* | *-*-mingw* | *-*-pw32*) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; ]) esac need_locks="$enable_libtool_lock" ])# _LT_AC_LOCK # AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [AC_REQUIRE([LT_AC_PROG_SED]) AC_CACHE_CHECK([$1], [$2], [$2=no ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; 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 $2=yes fi fi $rm conftest* ]) if test x"[$]$2" = xyes; then ifelse([$5], , :, [$5]) else ifelse([$6], , :, [$6]) fi ])# AC_LIBTOOL_COMPILER_OPTION # AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ------------------------------------------------------------ # Check whether the given compiler option works AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; 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 # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD else $2=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then ifelse([$4], , :, [$4]) else ifelse([$5], , :, [$5]) fi ])# AC_LIBTOOL_LINKER_OPTION # AC_LIBTOOL_SYS_MAX_CMD_LEN # -------------------------- AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [# find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; *) # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ = "XX$teststring") >/dev/null 2>&1 && new_result=`expr "X$teststring" : ".*" 2>&1` && lt_cv_sys_max_cmd_len=$new_result && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done teststring= # Add a significant safety factor because C++ compilers can tack on massive # amounts of additional arguments before passing them to the linker. # It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi ])# AC_LIBTOOL_SYS_MAX_CMD_LEN # _LT_AC_CHECK_DLFCN # -------------------- AC_DEFUN([_LT_AC_CHECK_DLFCN], [AC_CHECK_HEADERS(dlfcn.h)dnl ])# _LT_AC_CHECK_DLFCN # _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ------------------------------------------------------------------ AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], [AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } exit (status); }] EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_unknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_AC_TRY_DLOPEN_SELF # AC_LIBTOOL_DLOPEN_SELF # ------------------- AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_AC_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then LDFLAGS="$LDFLAGS $link_static_flag" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_AC_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; 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 ])# AC_LIBTOOL_DLOPEN_SELF # AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) # --------------------------------- # Check to see if options -c and -o are simultaneously supported by compiler AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], [AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext 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 _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* ]) ])# AC_LIBTOOL_PROG_CC_C_O # AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) # ----------------------------------------- # Check to see if we can do hard links to lock some files if needed AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_REQUIRE([_LT_AC_LOCK])dnl hard_links="nottested" if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) 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 AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi ])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS # AC_LIBTOOL_OBJDIR # ----------------- AC_DEFUN([AC_LIBTOOL_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir ])# AC_LIBTOOL_OBJDIR # AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) # ---------------------------------------------- # Check hardcoding attributes. AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_AC_TAGVAR(hardcode_action, $1)= if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \ test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then # We can hardcode non-existant directories. if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != 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 "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_AC_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_AC_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_AC_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = 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 ])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH # AC_LIBTOOL_SYS_LIB_STRIP # ------------------------ AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], [striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi ])# AC_LIBTOOL_SYS_LIB_STRIP # AC_LIBTOOL_SYS_DYNAMIC_LINKER # ----------------------------- # PORTME Fill in your ld.so characteristics AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_MSG_CHECKING([dynamic linker characteristics]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" 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" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) 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. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; 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}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi4*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH 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* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; *) # from 3.2 on shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case "$host_cpu" in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; 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}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`$SED -e 's/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g' /etc/ld.so.conf | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos need_lib_prefix=no need_version=yes library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH 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}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$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}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no ])# AC_LIBTOOL_SYS_DYNAMIC_LINKER # _LT_AC_TAGCONFIG # ---------------- AC_DEFUN([_LT_AC_TAGCONFIG], [AC_ARG_WITH([tags], [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], [include additional configurations @<:@automatic@:>@])], [tagnames="$withval"]) if test -f "$ltmain" && test -n "$tagnames"; then if test ! -f "${ofile}"; then AC_MSG_WARN([output file `$ofile' does not exist]) fi if test -z "$LTCC"; then eval "`$SHELL ${ofile} --config | grep '^LTCC='`" if test -z "$LTCC"; then AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) else AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) fi fi # Extract list of available tagged configurations in $ofile. # Note that this assumes the entire list is on one line. available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for tagname in $tagnames; do IFS="$lt_save_ifs" # Check whether tagname contains only valid characters case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in "") ;; *) AC_MSG_ERROR([invalid tag name: $tagname]) ;; esac if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null then AC_MSG_ERROR([tag name \"$tagname\" already exists]) fi # Update the list of available tags. if test -n "$tagname"; then echo appending configuration tag \"$tagname\" to $ofile case $tagname in CXX) if test -n "$CXX" && test "X$CXX" != "Xno"; then AC_LIBTOOL_LANG_CXX_CONFIG else tagname="" fi ;; F77) if test -n "$F77" && test "X$F77" != "Xno"; then AC_LIBTOOL_LANG_F77_CONFIG else tagname="" fi ;; GCJ) if test -n "$GCJ" && test "X$GCJ" != "Xno"; then AC_LIBTOOL_LANG_GCJ_CONFIG else tagname="" fi ;; RC) AC_LIBTOOL_LANG_RC_CONFIG ;; *) AC_MSG_ERROR([Unsupported tag name: $tagname]) ;; esac # Append the new tag name to the list of available tags. if test -n "$tagname" ; then available_tags="$available_tags $tagname" fi fi done IFS="$lt_save_ifs" # Now substitute the updated list of available tags. if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then mv "${ofile}T" "$ofile" chmod +x "$ofile" else rm -f "${ofile}T" AC_MSG_ERROR([unable to update list of available tagged configurations.]) fi fi ])# _LT_AC_TAGCONFIG # AC_LIBTOOL_DLOPEN # ----------------- # enable checks for dlopen support AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) ])# AC_LIBTOOL_DLOPEN # 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_LIBTOOL_WIN32_DLL # AC_ENABLE_SHARED([DEFAULT]) # --------------------------- # implement the --enable-shared flag # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. AC_DEFUN([AC_ENABLE_SHARED], [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([shared], [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], [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. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]AC_ENABLE_SHARED_DEFAULT) ])# AC_ENABLE_SHARED # 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_DISABLE_SHARED # AC_ENABLE_STATIC([DEFAULT]) # --------------------------- # implement the --enable-static flag # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. AC_DEFUN([AC_ENABLE_STATIC], [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([static], [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], [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. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]AC_ENABLE_STATIC_DEFAULT) ])# AC_ENABLE_STATIC # 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_DISABLE_STATIC # AC_ENABLE_FAST_INSTALL([DEFAULT]) # --------------------------------- # implement the --enable-fast-install flag # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. AC_DEFUN([AC_ENABLE_FAST_INSTALL], [define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([fast-install], [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [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. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) ])# AC_ENABLE_FAST_INSTALL # AC_DISABLE_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_DISABLE_FAST_INSTALL # AC_LIBTOOL_PICMODE([MODE]) # -------------------------- # implement the --with-pic flag # MODE is either `yes' or `no'. If omitted, it defaults to `both'. AC_DEFUN([AC_LIBTOOL_PICMODE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl pic_mode=ifelse($#,1,$1,default) ])# AC_LIBTOOL_PICMODE # AC_PROG_EGREP # ------------- # This is predefined starting with Autoconf 2.54, so this conditional # definition can be removed once we require Autoconf 2.54 or later. m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], [AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi]) EGREP=$ac_cv_prog_egrep AC_SUBST([EGREP]) ])]) # AC_PATH_TOOL_PREFIX # ------------------- # find a file program which can recognise shared library AC_DEFUN([AC_PATH_TOOL_PREFIX], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="ifelse([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" MAGIC_CMD="$lt_cv_path_MAGIC_CMD" 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 break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi ])# AC_PATH_TOOL_PREFIX # AC_PATH_MAGIC # ------------- # find a file program which can recognise a shared library AC_DEFUN([AC_PATH_MAGIC], [AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# AC_PATH_MAGIC # AC_PROG_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([AC_PROG_LD], [AC_ARG_WITH([gnu-ld], [AC_HELP_STRING([--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([LT_AC_PROG_SED])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname 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(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_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. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case "$host_cpu" in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu | knetbsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; nto-qnx*) lt_cv_deplibs_check_method=unknown ;; openbsd*) lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' else lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; sco3.2v5*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) case $host_vendor in motorola) lt_cv_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]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; esac ;; sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown ])# AC_DEPLIBS_CHECK_METHOD # AC_PROG_NM # ---------- # find the pathname to a BSD-compatible name lister AC_DEFUN([AC_PROG_NM], [AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/${ac_tool_prefix}nm" if test -f "$tmp_nm" || test -f "$tmp_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 # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac esac fi done IFS="$lt_save_ifs" test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi]) NM="$lt_cv_path_NM" ])# AC_PROG_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* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac ])# AC_CHECK_LIBM # AC_LIBLTDL_CONVENIENCE([DIRECTORY]) # ----------------------------------- # sets LIBLTDL to the link flags for the libltdl convenience library and # LTDLINCL to the include flags for the libltdl header and adds # --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL # and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If # DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will # be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with # '${top_srcdir}/' (note the single quotes!). If your package is not # flat and you're not using automake, define top_builddir and # top_srcdir appropriately 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='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) # For backwards non-gettext consistent compatibility... INCLTDL="$LTDLINCL" ])# AC_LIBLTDL_CONVENIENCE # AC_LIBLTDL_INSTALLABLE([DIRECTORY]) # ----------------------------------- # sets LIBLTDL to the link flags for the libltdl installable library and # LTDLINCL to the include flags for the libltdl header and adds # --enable-ltdl-install to the configure arguments. Note that LIBLTDL # and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If # DIRECTORY is not provided and an installed libltdl is not found, it is # assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' # and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single # quotes!). If your package is not flat and you're not using automake, # define top_builddir and top_srcdir appropriately 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, lt_dlinit, [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='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) else ac_configure_args="$ac_configure_args --enable-ltdl-install=no" LIBLTDL="-lltdl" LTDLINCL= fi # For backwards non-gettext consistent compatibility... INCLTDL="$LTDLINCL" ])# AC_LIBLTDL_INSTALLABLE # AC_LIBTOOL_CXX # -------------- # enable support for C++ libraries AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_LT_AC_LANG_CXX]) ])# AC_LIBTOOL_CXX # _LT_AC_LANG_CXX # --------------- AC_DEFUN([_LT_AC_LANG_CXX], [AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([AC_PROG_CXXCPP]) _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) ])# _LT_AC_LANG_CXX # AC_LIBTOOL_F77 # -------------- # enable support for Fortran 77 libraries AC_DEFUN([AC_LIBTOOL_F77], [AC_REQUIRE([_LT_AC_LANG_F77]) ])# AC_LIBTOOL_F77 # _LT_AC_LANG_F77 # --------------- AC_DEFUN([_LT_AC_LANG_F77], [AC_REQUIRE([AC_PROG_F77]) _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) ])# _LT_AC_LANG_F77 # AC_LIBTOOL_GCJ # -------------- # enable support for GCJ libraries AC_DEFUN([AC_LIBTOOL_GCJ], [AC_REQUIRE([_LT_AC_LANG_GCJ]) ])# AC_LIBTOOL_GCJ # _LT_AC_LANG_GCJ # --------------- AC_DEFUN([_LT_AC_LANG_GCJ], [AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) ])# _LT_AC_LANG_GCJ # AC_LIBTOOL_RC # -------------- # enable support for Windows resource files AC_DEFUN([AC_LIBTOOL_RC], [AC_REQUIRE([LT_AC_PROG_RC]) _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) ])# AC_LIBTOOL_RC # AC_LIBTOOL_LANG_C_CONFIG # ------------------------ # Ensure that the configuration vars for the C compiler are # suitably defined. Those variables are subsequently used by # AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) AC_DEFUN([_LT_AC_LANG_C_CONFIG], [lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}\n' _LT_AC_SYS_COMPILER # # Check for any special shared library compilation flags. # _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= if test "$GCC" = no; then case $host_os in sco3.2v5*) _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' ;; esac fi if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[ ]]" >/dev/null; then : else AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no fi fi # # Check to make sure the static flag actually works. # AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), [], [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) AC_LIBTOOL_PROG_LD_SHLIBS($1) AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) AC_LIBTOOL_SYS_LIB_STRIP AC_LIBTOOL_DLOPEN_SELF($1) # Report which librarie types wil actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) 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* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; darwin* | rhapsody*) if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case "$host_os" in rhapsody* | darwin1.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' ;; 10.*) _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' ;; esac fi ;; esac output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) AC_LIBTOOL_CONFIG($1) AC_LANG_POP CC="$lt_save_CC" ])# AC_LIBTOOL_LANG_C_CONFIG # AC_LIBTOOL_LANG_CXX_CONFIG # -------------------------- # Ensure that the configuration vars for the C compiler are # suitably defined. Those variables are subsequently used by # AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], [AC_LANG_PUSH(C++) AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([AC_PROG_CXXCPP]) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(allow_undefined_flag, $1)= _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(archive_expsym_cmds, $1)= _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= _LT_AC_TAGVAR(hardcode_minus_L, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=no _LT_AC_TAGVAR(module_cmds, $1)= _LT_AC_TAGVAR(module_expsym_cmds, $1)= _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown _LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_AC_TAGVAR(no_undefined_flag, $1)= _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Dependencies to place before and after the object being linked: _LT_AC_TAGVAR(predep_objects, $1)= _LT_AC_TAGVAR(postdep_objects, $1)= _LT_AC_TAGVAR(predeps, $1)= _LT_AC_TAGVAR(postdeps, $1)= _LT_AC_TAGVAR(compiler_lib_search_path, $1)= # Source file extension for C++ test sources. ac_ext=cc # Object file extension for compiled C++ test sources. objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration AC_PROG_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ grep 'no-whole-archive' > /dev/null; then _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_AC_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_AC_TAGVAR(archive_cmds, $1)='' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes if test "$GXX" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 _LT_AC_TAGVAR(hardcode_direct, $1)=yes else # We have old collect2 _LT_AC_TAGVAR(hardcode_direct, $1)=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 _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_AC_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' # -bexpall does not export symbols beginning with underscore (_) _LT_AC_TAGVAR(always_export_symbols, $1)=yes # Exported symbols can be pulled into shared objects from archives _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds it's shared libraries. _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; darwin* | rhapsody*) if test "$GXX" = yes; then _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case "$host_os" in rhapsody* | darwin1.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' ;; 10.*) _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' ;; esac fi ;; esac lt_int_apple_cc_single_mod=no output_verbose_link_cmd='echo' if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then lt_int_apple_cc_single_mod=yes fi if test "X$lt_int_apple_cc_single_mod" = Xyes ; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' fi _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's if test "X$lt_int_apple_cc_single_mod" = Xyes ; then _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' fi _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; dgux*) case $cc_basename in ec++) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; ghcx) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd[12]*) # C++ shared libraries reported to be fairly broken before switch to ELF _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | kfreebsd*-gnu) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_AC_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; hpux9*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; aCC) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then case "$host_cpu" in hppa*64*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ;; ia64*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ;; *) _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case "$host_cpu" in hppa*64*) _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; ia64*) _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; *) _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; aCC) case "$host_cpu" in hppa*64*|ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case "$host_cpu" in ia64*|hppa*64*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; irix5* | irix6*) case $cc_basename in CC) # SGI C++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi fi _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ;; linux*) case $cc_basename in KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc) # Intel C++ with_gnu_ld=yes _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; cxx) # Compaq C++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd* | netbsdelf*-gnu | knetbsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; osf3*) case $cc_basename in KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; cxx) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; osf4* | osf5*) case $cc_basename in KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; cxx) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ $rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; sco*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case $cc_basename in CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; sunos4*) case $cc_basename in CC) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; lcc) # Lucid # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system # linker. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | grep -v '^2\.7' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' fi ;; esac ;; sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; tandem*) case $cc_basename in NCC) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_AC_TAGVAR(GCC, $1)="$GXX" _LT_AC_TAGVAR(LD, $1)="$LD" AC_LIBTOOL_POSTDEP_PREDEP($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) AC_LIBTOOL_PROG_LD_SHLIBS($1) AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) AC_LIBTOOL_SYS_LIB_STRIP AC_LIBTOOL_DLOPEN_SELF($1) AC_LIBTOOL_CONFIG($1) AC_LANG_POP CC=$lt_save_CC LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ldcxx=$with_gnu_ld with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld ])# AC_LIBTOOL_LANG_CXX_CONFIG # AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) # ------------------------ # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <> "$cfgfile" ifelse([$1], [], [#! $SHELL # `$echo "$cfgfile" | 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 ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # # This file is part of GNU Libtool: # 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. # A sed program that does not truncate output. SED=$lt_SED # 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 "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi # The names of the tagged configurations supported by this script. available_tags= # ### BEGIN LIBTOOL CONFIG], [# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # 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 add -lc for building shared libraries. build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) # 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=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # A language-specific compiler. CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) # Is the compiler the GNU C compiler? with_gcc=$_LT_AC_TAGVAR(GCC, $1) # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_[]_LT_AC_TAGVAR(LD, $1) # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # 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=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) # Must we lock files when doing compilation ? need_locks=$lt_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_support=$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=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_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=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) # Commands used to build and install a shared archive. archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) # Flag that forces no undefined symbols. no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # 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=$_LT_AC_TAGVAR(hardcode_action, $1) # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" # Set to yes if exported symbols are required. always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) # The commands to list exported symbols. export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) # Symbols that must always be exported. include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) ifelse([$1],[], [# ### END LIBTOOL CONFIG], [# ### END LIBTOOL TAG CONFIG: $tagname]) __EOF__ ifelse([$1],[], [ case $host_os in aix3*) cat <<\EOF >> "$cfgfile" # 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 "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi EOF ;; esac # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || \ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ]) else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ])# AC_LIBTOOL_CONFIG # AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------------------- AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi ])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE # --------------------------------- AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_PROG_NM]) AC_REQUIRE([AC_OBJEXT]) # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # 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 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32*) symcode='[[ABCDGISTW]]' ;; hpux*) # Its linker distinguishes data from code symbols if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris* | sysv5*) symcode='[[BDRT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Try without a prefix undercore, then with it. for ac_symprfx in "" "_"; do # Write the raw and C identifiers. lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext < $nlist) && 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 grep ' nm_test_var$' "$nlist" >/dev/null; then if grep ' nm_test_func$' "$nlist" >/dev/null; then cat < conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' cat <> conftest.$ac_ext #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/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext cat <<\EOF >> conftest.$ac_ext {0, (lt_ptr_t) 0} }; #ifdef __cplusplus } #endif EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -f conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi ]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE # AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) # --------------------------------------- AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], [_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= _LT_AC_TAGVAR(lt_prog_compiler_static, $1)= AC_MSG_CHECKING([for $compiler option to produce PIC]) ifelse([$1],[CXX],[ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; 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'. _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | os2* | pw32*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= ;; sysv4*MP*) if test -d /usr/nec; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case "$host_cpu" in hppa*64*|ia64*) ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix4* | aix5*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; dgux*) case $cc_basename in ec++) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | kfreebsd*-gnu) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in hppa*64*|ia64*) # +Z the default ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux*) case $cc_basename in KCC) # KAI C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; icpc) # Intel C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; cxx) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu | knetbsd*-gnu) ;; osf3* | osf4* | osf5*) case $cc_basename in KCC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC) # Rational C++ 2.4.1 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx) # Digital/Compaq C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; sco*) case $cc_basename in CC) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; *) ;; esac ;; solaris*) case $cc_basename in CC) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC) # Sun C++ 4.x _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc) # Lucid _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; tandem*) case $cc_basename in NCC) # NonStop-UX NCC 3.20 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; unixware*) ;; vxworks*) ;; *) _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; 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'. _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case "$host_cpu" in hppa*64*|ia64*) # +Z the default ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case "$host_cpu" in hppa*64*|ia64*) # +Z the default ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; newsos6) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; linux*) case $CC in icc* | ecc*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; ccc*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; sco3.2v5*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' ;; solaris*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sunos4*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; uts4*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi case "$host_os" in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" ;; esac ]) # AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) # ------------------------------------ # See if the linker supports building shared libraries. AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) ifelse([$1],[CXX],[ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in aix4* | aix5*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' else _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw*) _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' ;; linux*) _LT_AC_TAGVAR(link_all_deplibs, $1)=no ;; *) _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ],[ runpath_var= _LT_AC_TAGVAR(allow_undefined_flag, $1)= _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_AC_TAGVAR(archive_cmds, $1)= _LT_AC_TAGVAR(archive_expsym_cmds, $1)= _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_minus_L, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown _LT_AC_TAGVAR(hardcode_automatic, $1)=no _LT_AC_TAGVAR(module_cmds, $1)= _LT_AC_TAGVAR(module_expsym_cmds, $1)= _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(export_symbols_cmds, $1)='$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 _LT_AC_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp 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'. _LT_AC_TAGVAR(exclude_expsyms, $1)="_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. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32*) # 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 "$GCC" != yes; then with_gnu_ld=no fi ;; openbsd*) with_gnu_ld=no ;; esac _LT_AC_TAGVAR(ld_shlibs, $1)=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* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(ld_shlibs, $1)=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 fi ;; amigaos*) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_minus_L, $1)=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't use # them. _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu | knetbsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris* | sysv5*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then _LT_AC_TAGVAR(ld_shlibs, $1)=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 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; sunos4*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_cmds, $1)="$tmp_archive_cmds" supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac if test $supports_anon_versioning = yes; then _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' else _LT_AC_TAGVAR(archive_expsym_cmds, $1)="$tmp_archive_cmds" fi _LT_AC_TAGVAR(link_all_deplibs, $1)=no else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then runpath_var=LD_RUN_PATH _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= fi fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(always_export_symbols, $1)=yes _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$link_static_flag"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' else _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_AC_TAGVAR(archive_cmds, $1)='' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 _LT_AC_TAGVAR(hardcode_direct, $1)=yes else # We have old collect2 _LT_AC_TAGVAR(hardcode_direct, $1)=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 _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_AC_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' # -bexpall does not export symbols beginning with underscore (_) _LT_AC_TAGVAR(always_export_symbols, $1)=yes # Exported symbols can be pulled into shared objects from archives _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds it's shared libraries. _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # see comment about different semantics on the GNU ld section _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; bsdi4*) _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32*) # 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. _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path='`cygpath -w "$srcfile"`' _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; darwin* | rhapsody*) if test "$GXX" = yes ; then _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case "$host_os" in rhapsody* | darwin1.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' ;; 10.*) _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' ;; esac fi ;; esac lt_int_apple_cc_single_mod=no output_verbose_link_cmd='echo' if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then lt_int_apple_cc_single_mod=yes fi if test "X$lt_int_apple_cc_single_mod" = Xyes ; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' fi _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's if test "X$lt_int_apple_cc_single_mod" = Xyes ; then _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' fi _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; dgux*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; freebsd1*) _LT_AC_TAGVAR(ld_shlibs, $1)=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*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10* | hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case "$host_cpu" in hppa*64*|ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case "$host_cpu" in hppa*64*|ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; esac fi if test "$with_gnu_ld" = no; then case "$host_cpu" in hppa*64*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; ia64*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes ;; *) _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd* | netbsdelf*-gnu | knetbsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; openbsd*) _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi ;; os2*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ;; sco3.2v5*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ;; solaris*) _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$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 $linker_flags~$rm $lib.exp' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_AC_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_AC_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4.2uw2*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no hardcode_runpath_var=yes runpath_var=LD_RUN_PATH ;; sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' fi runpath_var='LD_RUN_PATH' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv5*) _LT_AC_TAGVAR(no_undefined_flag, $1)=' -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 _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$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 $linker_flags~$rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' ;; uts4*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac fi ]) AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi # # Do we need to explicitly link libc? # case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_AC_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_MSG_CHECKING([whether -lc should be explicitly linked in]) $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) _LT_AC_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) then _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no else _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) ;; esac fi ;; esac ])# AC_LIBTOOL_PROG_LD_SHLIBS # _LT_AC_FILE_LTDLL_C # ------------------- # Be careful that the start marker always follows a newline. AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ # /* 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 */ ])# _LT_AC_FILE_LTDLL_C # _LT_AC_TAGVAR(VARNAME, [TAGNAME]) # --------------------------------- AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) # old names AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) # This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL]) AC_DEFUN([LT_AC_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj, no) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS) ]) AC_DEFUN([LT_AC_PROG_RC], [AC_CHECK_TOOL(RC, windres, no) ]) # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # # LT_AC_PROG_SED # -------------- # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. AC_DEFUN([LT_AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && break cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done SED=$lt_cv_path_SED ]) AC_MSG_RESULT([$SED]) ]) # longdouble.m4 serial 1 (gettext-0.12) dnl Copyright (C) 2002-2003 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 From Bruno Haible. dnl Test whether the compiler supports the 'long double' type. dnl Prerequisite: AC_PROG_CC AC_DEFUN([gt_TYPE_LONGDOUBLE], [ AC_CACHE_CHECK([for long double], gt_cv_c_long_double, [if test "$GCC" = yes; then gt_cv_c_long_double=yes else AC_TRY_COMPILE([ /* The Stardent Vistra knows sizeof(long double), but does not support it. */ long double foo = 0.0; /* On Ultrix 4.3 cc, long double is 4 and double is 8. */ int array [2*(sizeof(long double) >= sizeof(double)) - 1]; ], , gt_cv_c_long_double=yes, gt_cv_c_long_double=no) fi]) if test $gt_cv_c_long_double = yes; then AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.]) fi ]) # longlong.m4 serial 5 dnl Copyright (C) 1999-2004 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 From Paul Eggert. # Define HAVE_LONG_LONG if 'long long' works. AC_DEFUN([gl_AC_TYPE_LONG_LONG], [ AC_CACHE_CHECK([for long long], ac_cv_type_long_long, [AC_TRY_LINK([long long ll = 1LL; int i = 63;], [long long llmax = (long long) -1; return ll << i | ll >> i | llmax / ll | llmax % ll;], ac_cv_type_long_long=yes, ac_cv_type_long_long=no)]) if test $ac_cv_type_long_long = yes; then AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have the 'long long' type.]) fi ]) # nls.m4 serial 2 (gettext-0.14.3) dnl Copyright (C) 1995-2003, 2005 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 dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1995-2000. dnl Bruno Haible , 2000-2003. AC_PREREQ(2.50) AC_DEFUN([AM_NLS], [ AC_MSG_CHECKING([whether NLS is requested]) dnl Default is enabled NLS AC_ARG_ENABLE(nls, [ --disable-nls do not use Native Language Support], USE_NLS=$enableval, USE_NLS=yes) AC_MSG_RESULT($USE_NLS) AC_SUBST(USE_NLS) ]) AC_DEFUN([AM_MKINSTALLDIRS], [ dnl Tell automake >= 1.10 to complain if mkinstalldirs is missing. m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([mkinstalldirs])]) dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly dnl find the mkinstalldirs script in another subdir but $(top_srcdir). dnl Try to locate it. MKINSTALLDIRS= if test -n "$ac_aux_dir"; then case "$ac_aux_dir" in /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;; *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;; esac fi if test -z "$MKINSTALLDIRS"; then MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" fi AC_SUBST(MKINSTALLDIRS) ]) # po.m4 serial 7 (gettext-0.14.3) dnl Copyright (C) 1995-2005 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 dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1995-2000. dnl Bruno Haible , 2000-2003. AC_PREREQ(2.50) dnl Checks for all prerequisites of the po subdirectory. AC_DEFUN([AM_PO_SUBDIRS], [ AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl AC_REQUIRE([AM_MKINSTALLDIRS])dnl AC_REQUIRE([AM_NLS])dnl dnl Perform the following tests also if --disable-nls has been given, dnl because they are needed for "make dist" to work. dnl Search for GNU msgfmt in the PATH. dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. dnl The second test excludes FreeBSD msgfmt. AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], :) AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) dnl Search for GNU xgettext 0.12 or newer in the PATH. dnl The first test excludes Solaris xgettext and early GNU xgettext versions. dnl The second test excludes FreeBSD xgettext. AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], :) dnl Remove leftover from FreeBSD xgettext call. rm -f messages.po dnl Search for GNU msgmerge 0.11 or newer in the PATH. AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. dnl Test whether we really found GNU msgfmt. if test "$GMSGFMT" != ":"; then dnl If it is no GNU msgfmt we define it as : so that the dnl Makefiles still can work. if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then : ; else GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` AC_MSG_RESULT( [found $GMSGFMT program is not GNU msgfmt; ignore it]) GMSGFMT=":" fi fi dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. dnl Test whether we really found GNU xgettext. if test "$XGETTEXT" != ":"; then dnl If it is no GNU xgettext we define it as : so that the dnl Makefiles still can work. if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then : ; else AC_MSG_RESULT( [found xgettext program is not GNU xgettext; ignore it]) XGETTEXT=":" fi dnl Remove leftover from FreeBSD xgettext call. rm -f messages.po fi AC_OUTPUT_COMMANDS([ for ac_file in $CONFIG_FILES; do # Support "outfile[:infile[:infile...]]" case "$ac_file" in *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; esac # PO directories have a Makefile.in generated from Makefile.in.in. case "$ac_file" in */Makefile.in) # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" case "$ac_given_srcdir" in .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac # Treat a directory as a PO directory if and only if it has a # POTFILES.in file. This allows packages to have multiple PO # directories under different names or in different locations. if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then rm -f "$ac_dir/POTFILES" test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" POMAKEFILEDEPS="POTFILES.in" # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend # on $ac_dir but don't depend on user-specified configuration # parameters. if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then # The LINGUAS file contains the set of available languages. if test -n "$OBSOLETE_ALL_LINGUAS"; then test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" fi ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` # Hide the ALL_LINGUAS assigment from automake. eval 'ALL_LINGUAS''=$ALL_LINGUAS_' POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" else # The set of available languages was given in configure.in. eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' fi # Compute POFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) # Compute UPDATEPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) # Compute DUMMYPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) # Compute GMOFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) case "$ac_given_srcdir" in .) srcdirpre= ;; *) srcdirpre='$(srcdir)/' ;; esac POFILES= UPDATEPOFILES= DUMMYPOFILES= GMOFILES= for lang in $ALL_LINGUAS; do POFILES="$POFILES $srcdirpre$lang.po" UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" DUMMYPOFILES="$DUMMYPOFILES $lang.nop" GMOFILES="$GMOFILES $srcdirpre$lang.gmo" done # CATALOGS depends on both $ac_dir and the user's LINGUAS # environment variable. INST_LINGUAS= if test -n "$ALL_LINGUAS"; then for presentlang in $ALL_LINGUAS; do useit=no if test "%UNSET%" != "$LINGUAS"; then desiredlanguages="$LINGUAS" else desiredlanguages="$ALL_LINGUAS" fi for desiredlang in $desiredlanguages; do # Use the presentlang catalog if desiredlang is # a. equal to presentlang, or # b. a variant of presentlang (because in this case, # presentlang can be used as a fallback for messages # which are not translated in the desiredlang catalog). case "$desiredlang" in "$presentlang"*) useit=yes;; esac done if test $useit = yes; then INST_LINGUAS="$INST_LINGUAS $presentlang" fi done fi CATALOGS= if test -n "$INST_LINGUAS"; then for lang in $INST_LINGUAS; do CATALOGS="$CATALOGS $lang.gmo" done fi test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do if test -f "$f"; then case "$f" in *.orig | *.bak | *~) ;; *) cat "$f" >> "$ac_dir/Makefile" ;; esac fi done fi ;; esac done], [# Capture the value of obsolete ALL_LINGUAS because we need it to compute # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it # from automake. eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' # Capture the value of LINGUAS because we need it to compute CATALOGS. LINGUAS="${LINGUAS-%UNSET%}" ]) ]) dnl Postprocesses a Makefile in a directory containing PO files. AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], [ # When this code is run, in config.status, two variables have already been # set: # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in, # - LINGUAS is the value of the environment variable LINGUAS at configure # time. changequote(,)dnl # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" case "$ac_given_srcdir" in .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac # Find a way to echo strings without interpreting backslash. if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then gt_echo='echo' else if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then gt_echo='printf %s\n' else echo_func () { cat < "$ac_file.tmp" if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then # Add dependencies that cannot be formulated as a simple suffix rule. for lang in $ALL_LINGUAS; do frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` cat >> "$ac_file.tmp" < /dev/null; then # Add dependencies that cannot be formulated as a simple suffix rule. for lang in $ALL_LINGUAS; do frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` cat >> "$ac_file.tmp" <> "$ac_file.tmp" < #include /* The string "%2$d %1$d", with dollar characters protected from the shell's dollar expansion (possibly an autoconf bug). */ static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; static char buf[100]; int main () { sprintf (buf, format, 33, 55); return (strcmp (buf, "55 33") != 0); }], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no, [ AC_EGREP_CPP(notposix, [ #if defined __NetBSD__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ notposix #endif ], gt_cv_func_printf_posix="guessing no", gt_cv_func_printf_posix="guessing yes") ]) ]) case $gt_cv_func_printf_posix in *yes) AC_DEFINE(HAVE_POSIX_PRINTF, 1, [Define if your printf() function supports format strings with positions.]) ;; esac ]) # progtest.m4 serial 4 (gettext-0.14.2) dnl Copyright (C) 1996-2003, 2005 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 dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1996. AC_PREREQ(2.50) # Search path for a program which passes the given test. dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) AC_DEFUN([AM_PATH_PROG_WITH_TEST], [ # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "$2", so it can be a program name with args. set dummy $2; ac_word=[$]2 AC_MSG_CHECKING([for $ac_word]) AC_CACHE_VAL(ac_cv_path_$1, [case "[$]$1" in [[\\/]]* | ?:[[\\/]]*) ac_cv_path_$1="[$]$1" # Let the user override the test with a path. ;; *) ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in ifelse([$5], , $PATH, [$5]); do IFS="$ac_save_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD if [$3]; then ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$ac_save_IFS" dnl If no 4th arg is given, leave the cache variable unset, dnl so AC_PATH_PROGS will keep looking. ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" ])dnl ;; esac])dnl $1="$ac_cv_path_$1" if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then AC_MSG_RESULT([$]$1) else AC_MSG_RESULT(no) fi AC_SUBST($1)dnl ]) # signed.m4 serial 1 (gettext-0.10.40) dnl Copyright (C) 2001-2002 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 From Bruno Haible. AC_DEFUN([bh_C_SIGNED], [ AC_CACHE_CHECK([for signed], bh_cv_c_signed, [AC_TRY_COMPILE(, [signed char x;], bh_cv_c_signed=yes, bh_cv_c_signed=no)]) if test $bh_cv_c_signed = no; then AC_DEFINE(signed, , [Define to empty if the C compiler doesn't support this keyword.]) fi ]) # size_max.m4 serial 2 dnl Copyright (C) 2003 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 From Bruno Haible. AC_DEFUN([gl_SIZE_MAX], [ AC_CHECK_HEADERS(stdint.h) dnl First test whether the system already has SIZE_MAX. AC_MSG_CHECKING([for SIZE_MAX]) result= AC_EGREP_CPP([Found it], [ #include #if HAVE_STDINT_H #include #endif #ifdef SIZE_MAX Found it #endif ], result=yes) if test -z "$result"; then dnl Define it ourselves. Here we assume that the type 'size_t' is not wider dnl than the type 'unsigned long'. dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr', dnl which is guaranteed to work from LONG_MIN to LONG_MAX. _AC_COMPUTE_INT([~(size_t)0 / 10], res_hi, [#include ], result=?) _AC_COMPUTE_INT([~(size_t)0 % 10], res_lo, [#include ], result=?) _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint, [#include ], result=?) if test "$fits_in_uint" = 1; then dnl Even though SIZE_MAX fits in an unsigned int, it must be of type dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. AC_TRY_COMPILE([#include extern size_t foo; extern unsigned long foo; ], [], fits_in_uint=0) fi if test -z "$result"; then if test "$fits_in_uint" = 1; then result="$res_hi$res_lo"U else result="$res_hi$res_lo"UL fi else dnl Shouldn't happen, but who knows... result='~(size_t)0' fi fi AC_MSG_RESULT([$result]) if test "$result" != yes; then AC_DEFINE_UNQUOTED([SIZE_MAX], [$result], [Define as the maximum value of type 'size_t', if the system doesn't define it.]) fi ]) # stdint_h.m4 serial 5 dnl Copyright (C) 1997-2004 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 From Paul Eggert. # Define HAVE_STDINT_H_WITH_UINTMAX if exists, # doesn't clash with , and declares uintmax_t. AC_DEFUN([gl_AC_HEADER_STDINT_H], [ AC_CACHE_CHECK([for stdint.h], gl_cv_header_stdint_h, [AC_TRY_COMPILE( [#include #include ], [uintmax_t i = (uintmax_t) -1;], gl_cv_header_stdint_h=yes, gl_cv_header_stdint_h=no)]) if test $gl_cv_header_stdint_h = yes; then AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1, [Define if exists, doesn't clash with , and declares uintmax_t. ]) fi ]) # uintmax_t.m4 serial 9 dnl Copyright (C) 1997-2004 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 From Paul Eggert. AC_PREREQ(2.13) # Define uintmax_t to 'unsigned long' or 'unsigned long long' # if it is not already defined in or . AC_DEFUN([gl_AC_TYPE_UINTMAX_T], [ AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) AC_REQUIRE([gl_AC_HEADER_STDINT_H]) if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then AC_REQUIRE([gl_AC_TYPE_UNSIGNED_LONG_LONG]) test $ac_cv_type_unsigned_long_long = yes \ && ac_type='unsigned long long' \ || ac_type='unsigned long' AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, [Define to unsigned long or unsigned long long if and don't define.]) else AC_DEFINE(HAVE_UINTMAX_T, 1, [Define if you have the 'uintmax_t' type in or .]) fi ]) # ulonglong.m4 serial 4 dnl Copyright (C) 1999-2004 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 From Paul Eggert. # Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works. AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG], [ AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long, [AC_TRY_LINK([unsigned long long ull = 1ULL; int i = 63;], [unsigned long long ullmax = (unsigned long long) -1; return ull << i | ull >> i | ullmax / ull | ullmax % ull;], ac_cv_type_unsigned_long_long=yes, ac_cv_type_unsigned_long_long=no)]) if test $ac_cv_type_unsigned_long_long = yes; then AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1, [Define if you have the 'unsigned long long' type.]) fi ]) # wchar_t.m4 serial 1 (gettext-0.12) dnl Copyright (C) 2002-2003 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 From Bruno Haible. dnl Test whether has the 'wchar_t' type. dnl Prerequisite: AC_PROG_CC AC_DEFUN([gt_TYPE_WCHAR_T], [ AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t, [AC_TRY_COMPILE([#include wchar_t foo = (wchar_t)'\0';], , gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)]) if test $gt_cv_c_wchar_t = yes; then AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.]) fi ]) # wint_t.m4 serial 1 (gettext-0.12) dnl Copyright (C) 2003 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 From Bruno Haible. dnl Test whether has the 'wint_t' type. dnl Prerequisite: AC_PROG_CC AC_DEFUN([gt_TYPE_WINT_T], [ AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t, [AC_TRY_COMPILE([#include wint_t foo = (wchar_t)'\0';], , gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)]) if test $gt_cv_c_wint_t = yes; then AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.]) fi ]) # xsize.m4 serial 3 dnl Copyright (C) 2003-2004 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. AC_DEFUN([gl_XSIZE], [ dnl Prerequisites of lib/xsize.h. AC_REQUIRE([gl_SIZE_MAX]) AC_REQUIRE([AC_C_INLINE]) AC_CHECK_HEADERS(stdint.h) ]) # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. # # This file 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. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.9.5])]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file 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. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file 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. # serial 7 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE]) AC_SUBST([$1_FALSE]) if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file 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. # serial 8 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH]) ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file 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. #serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file 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. # serial 8 # AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file 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. # serial 12 # 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. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.58])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])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 # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl ]) ]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $1 | $1:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file 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. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file 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. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file 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. # serial 4 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 ] ) AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file 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. # serial 3 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file 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. # serial 4 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. # # This file 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. # AM_PROG_MKDIR_P # --------------- # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. # # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories # created by `make install' are always world readable, even if the # installer happens to have an overly restrictive umask (e.g. 077). # This was a mistake. There are at least two reasons why we must not # use `-m 0755': # - it causes special bits like SGID to be ignored, # - it may be too restrictive (some setups expect 775 directories). # # Do not use -m 0755 and let people choose whatever they expect by # setting umask. # # We cannot accept any implementation of `mkdir' that recognizes `-p'. # Some implementations (such as Solaris 8's) are not thread-safe: if a # parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' # concurrently, both version can detect that a/ is missing, but only # one can create it and the other will error out. Consequently we # restrict ourselves to GNU make (using the --version option ensures # this.) AC_DEFUN([AM_PROG_MKDIR_P], [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # We used to keeping the `.' as first argument, in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However this is wrong # for two reasons: # 1. if the package is installed by a user who cannot write `.' # make install will fail, # 2. the above comment should most certainly read # $(mkdir_p) $(DESTDIR)$(somedir) # so it does not work when $(somedir) is undefined and # $(DESTDIR) is not. # To support the latter case, we have to write # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), # so the `.' trick is pointless. mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi AC_SUBST([mkdir_p])]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file 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. # serial 3 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file 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. # serial 4 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # 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 conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $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]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file 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. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file 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. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR lpe-1.2.7/CUSTOMIZE0000644000175000017500000001517407136116754012550 0ustar adammadammCustomization Guide for Lpe This file describes where to start in customizing lpe to fit your own preferences. As of version 1.2.4, lpe reads a configuration file that can be used to customize its behavior. I will be adding more options to this config file as time goes on, and that will be most of what this document describes. If you are using a version prior to 1.2.4-mhp-2, you'll need to check out the CUSTOMIZE file from that distribution, as this information will not apply. The configuration files are SLang scripts, however, you don't have to know SLang to be able to configure lpe. This documentation will show you the basic things that can get you started. The main configuration file is located at $sysconfdir/lperc, depending on how you configured lpe this can be anything. Most common configurations will probably be the following: /usr/local/etc/lperc /usr/etc/lperc /etc/lperc A per-user configuration file exists too, it is located in ~/.lpe/custom Before modifying the main file, it is a good idea to test the modifications in the per-user configuratio file, so you won't break anything. Lpe does NOT stop at the first file. Instead, it reads all files present, and values in later files override values from prior files. This means that you can use the .lpe/custom file from your home directory to override site-wide defaults in /etc/lperc, or compiled-in application defaults. The application defaults are only used if none of the configuration files can be found. As I said before, the configuration files are SLang scripts, therefore you can place SLang function calls into them and whatever SLang allows. For beginners, the lpe_set_mode_option function will be the most useful. Currently, this is the only function that affects lpe directly. Its syntax is the following: lpe_set_option (