From octave-sources-request at bevo dot che dot wisc dot edu Wed Jul 11 07:47:03 2001 Subject: octave-config script From: Rafael Laboissiere To: octave-sources at bevo dot che dot wisc dot edu Date: Wed, 11 Jul 2001 14:44:15 +0200 --yrj/dFKFPuw6o+aM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, In generating third party packages for Octave, I usually have to guess in my configure.in script where the .oct and .m should go. I dreamed of having a script like gtk-config, which I could use like this: $ octave-config --version 2.1.34 $ octave-config --oct-site-dir /usr/lib/octave/2.1.34/site/oct/i386-pc-linux-gnu $ octave-config --m-site-dir /usr/share/octave/2.1.34/site/m The dream became true, and below is a patch to the CVS sources of Octave (dated 20001/07/11). For now, the script only accepts the options shown above, but it is very easy to add others. I carefully modified the relevant files at the top-level, taking the generation of the octave-bug script as an example. Here is the ChangeLog entry: 2001-07-11 Rafael Laboissiere * octave-config.in: New file. * Makeconf.in (do-subst-config-vals): Added substitution for OCTAVE_VERSION. * Makefile.in (TARGETS): Added octave-config. * octMakefile.in (DISTFILES): Added octave-config.in. (BINDISTFILES): Added octave-config. (all): Added octave-config dependency. (octave-config): New rule. (install): Remove octave-config script from bindir. (maintainer-clean): Remove octave-config. (binary-dist): Added octave-config dependency. -- Rafael Laboissiere --yrj/dFKFPuw6o+aM Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=diff-octave-config diff -Naur octave-cvs-20010711/ChangeLog octave-cvs-20010711-config/ChangeLog --- octave-cvs-20010711/ChangeLog Wed Jul 11 14:17:58 2001 +++ octave-cvs-20010711-config/ChangeLog Wed Jul 11 14:24:24 2001 at @ -1,3 +1,17 @@ +2001-07-11 Rafael Laboissiere + + * octave-config.in: New file. + * Makeconf.in (do-subst-config-vals): Added substitution for + OCTAVE_VERSION. + * Makefile.in (TARGETS): Added octave-config. + * octMakefile.in (DISTFILES): Added octave-config.in. + (BINDISTFILES): Added octave-config. + (all): Added octave-config dependency. + (octave-config): New rule. + (install): Remove octave-config script from bindir. + (maintainer-clean): Remove octave-config. + (binary-dist): Added octave-config dependency. + 2001-06-29 Mumit Khan * aclocal.m4 (OCTAVE_CXX_ABI): Use "sun_v5" instead of "sun". diff -Naur octave-cvs-20010711/Makefile.in octave-cvs-20010711-config/Makefile.in --- octave-cvs-20010711/Makefile.in Wed Jul 11 14:17:58 2001 +++ octave-cvs-20010711-config/Makefile.in Wed Jul 11 14:22:33 2001 at @ -9,7 +9,7 @@ TARGETS = octave-bug mkoctfile libcruft liboctave kpathsea dlfcn \ readline src scripts doc check octave.info INSTALL.OCTAVE BUGS \ install install-strip uninstall tags TAGS dist conf-dist \ - snapshot snapshot-version + snapshot snapshot-version octave-config NO_DEP_TARGETS = clean mostlyclean distclean maintainer-clean at @ -85,6 +85,7 @@ at echo " maintainer-clean clean up everything" at echo "" at echo " octave-bug create octave-bug script" + at echo " octave-config create octave-config script" at echo " mkoctfile create mkoctfile script" at echo " INSTALL.OCTAVE create INSTALL.OCTAVE doc file" at echo " BUGS create BUGS doc file" diff -Naur octave-cvs-20010711/install-octave.in octave-cvs-20010711-config/install-octave.in --- octave-cvs-20010711/install-octave.in Wed Jul 11 14:17:58 2001 +++ octave-cvs-20010711-config/install-octave.in Wed Jul 11 14:22:33 2001 at @ -217,6 +217,10 @@ cp octave-bug $bindir/octave-bug chmod 755 $bindir/octave-bug +echo "installing octave-config as $bindir/octave-config" +cp octave-config $bindir/octave-config +chmod 755 $bindir/octave-config + if test -f LIBRARIES; then echo "installing shared libraries in $octlibdir" for f in `cat LIBRARIES` diff -Naur octave-cvs-20010711/octMakefile.in octave-cvs-20010711-config/octMakefile.in --- octave-cvs-20010711/octMakefile.in Wed Jul 11 14:17:58 2001 +++ octave-cvs-20010711-config/octMakefile.in Wed Jul 11 14:22:33 2001 at @ -28,7 +28,7 @@ PROJECTS README README.Linux README.Windows README.MachTen ROADMAP \ SENDING-PATCHES THANKS move-if-change octave-sh octave-bug.in \ install-octave.in mkinstalldirs mkoctfile.in texi2dvi \ - ChangeLog ChangeLog.[0-9] + ChangeLog ChangeLog.[0-9] octave-config.in # Complete directory trees to distribute. DISTDIRS = glob kpathsea # plplot at @ -54,7 +54,7 @@ ChangeLog ChangeLog.[0-9] BINDISTFILES = $(addprefix $(srcdir)/, $(XBINDISTFILES)) \ - octave-bug config.status config.h VERSION ARCH + octave-bug octave-config config.status config.h VERSION ARCH # Subdirectories in which to run `make bin-dist'. BINDISTSUBDIRS = libcruft liboctave src scripts doc emacs examples at @ -67,7 +67,7 @@ `echo $(localfcnfilepath) | awk -F: '{for (i=1; i<=NF; i++) print $$i}'` \ `echo $(localoctfilepath) | awk -F: '{for (i=1; i<=NF; i++) print $$i}'` -all: octave-bug mkoctfile src +all: octave-bug octave-config mkoctfile src .PHONY: all src: $(SUBDIRS) at @ -78,6 +78,10 @@ at $(do-subst-config-vals) chmod a+rx $ at +octave-config: octave-config.in Makeconf octMakefile + at $(do-subst-default-vals) + chmod a+rx $ at + mkoctfile: mkoctfile.in Makeconf octMakefile at $(do-subst-config-vals) chmod a+rx $ at at @ -107,6 +111,9 @@ rm -f $(bindir)/octave-bug $(INSTALL_SCRIPT) octave-bug $(bindir)/octave-bug-$(version) cd $(bindir); $(LN_S) octave-bug-$(version) octave-bug + rm -f $(bindir)/octave-config + $(INSTALL_SCRIPT) octave-config $(bindir)/octave-config-$(version) + cd $(bindir); $(LN_S) octave-config-$(version) octave-config rm -f $(bindir)/mkoctfile $(INSTALL_SCRIPT) mkoctfile $(bindir)/mkoctfile-$(version) cd $(bindir); $(LN_S) mkoctfile-$(version) mkoctfile at @ -131,7 +138,7 @@ .PHONY: clean mostlyclean distclean maintainer-clean maintainer-clean distclean:: - rm -f octMakefile octave-bug Makeconf config.cache \ + rm -f octMakefile octave-bug octave-config Makeconf config.cache \ config.h config.log config.status Makerules.f77 mk-oct-links \ mkoctfile Makefrag.f77 at @ -216,7 +223,7 @@ echo $(canonical_host_type) > ARCH .PHONY: ARCH -binary-dist: VERSION ARCH octave-bug dist-info-files +binary-dist: VERSION ARCH octave-bug octave-config dist-info-files echo octave-$(version)-$(canonical_host_type) > .fname rm -rf `cat .fname` mkdir `cat .fname` diff -Naur octave-cvs-20010711/octave-config.in octave-cvs-20010711-config/octave-config.in --- octave-cvs-20010711/octave-config.in Thu Jan 1 01:00:00 1970 +++ octave-cvs-20010711-config/octave-config.in Wed Jul 11 14:22:49 2001 at @ -0,0 +1,46 @@ +#! /bin/sh - +# +# octave-config - reports some configuration values for Octave +# +# Rafael Laboissiere +# This script is in the public domain + +VERSION=%OCTAVE_VERSION% +OCT_SITE_DIR=%OCTAVE_LOCALVEROCTFILEDIR% +M_SITE_DIR=%OCTAVE_LOCALVERFCNFILEDIR% + +usage() +{ + cat <&2 +fi + +while test $# -gt 0; do + + case $1 in + --version) + echo $VERSION + ;; + --oct-site-dir) + echo $OCT_SITE_DIR + ;; + --m-site-dir) + echo $M_SITE_DIR + ;; + --help|*) + usage 1 1>&2 + ;; + esac + shift +done --yrj/dFKFPuw6o+aM--