diff -ur qc--20060131.orig/configure qc--20060131/configure --- qc--20060131.orig/configure 2005-11-05 22:15:24.000000000 +0100 +++ qc--20060131/configure 2006-02-02 14:29:07.000000000 +0100 @@ -93,7 +93,22 @@ # for file in dirs and return, full path, if found, and "" otherwise. # -sub search { search_with( sub($) { return (-f shift) }, @_) } +sub combine { + my $base = shift; + my $file = shift; + return ("$base/$file") +}; + +sub search { search_with( sub($) { return (-f shift) }, \&combine, @_) } + +sub search_suffix { + my $f = sub($) { + my $suffix = shift; + my $base = shift; + return ($base . $suffix); + }; + search_with(sub($) { return (-f shift) }, $f, @_) +} sub searchx { my $f = sub($) { @@ -105,16 +120,17 @@ } return (1==2); # how do you write false in perl? }; - search_with($f, @_) + search_with($f, \&combine, @_) } sub search_with { my $p = shift; + my $com = shift; my $file = shift; - printf(LOG "searching for %-20s", $file); + printf(LOG "searching for %-20s ", $file); while ($f = shift (@_)) { - my $x = "$f/$file"; + my $x = &$com($f, $file); if (&$p($x)) { print LOG "found $x\n"; return $x @@ -124,6 +140,20 @@ return ""; } +#configure lua based on some known installation prefix +sub config_lua { + my $base = shift; + @libsuffix = ( ".so", "40.so", ".a", "40.a" ); + + $x{lua_h} = "$base/include/lua.h"; + $x{lualib_h} = "$base/include/lualib.h"; + $x{liblua} = search_suffix("$base/lib/liblua", @libsuffix); + $x{liblualib} = search_suffix("$base/lib/liblualib", @libsuffix); + $x{lua_inc} = "-I$base/include"; + $x{lua_lib} = "-L$base/lib/"; + $x{lua_libs} = "-llua -llualib"; +} + # # compile and run a small C program to find out about architecture @@ -183,6 +213,8 @@ ./configure [options] + --with-lua=/lua/path lua is installed in /lua/path the default + is to search for standard locations --prefix=/usr/local install into the /usr/local hierarchy which is also the default -h, --help this summary @@ -224,15 +256,15 @@ # We start from here with reading the command line # ------------------------------------------------------------------ +open (LOG, ">$configure_log") || die "cannot write configure.log: $!"; + foreach (@ARGV) { if (/^--?prefix=(.*)$/) { $x{prefix}=$1 } elsif (/^--?h(elp?)$/) { usage(); exit 0 } + elsif (/^--?with-lua=(.*)$/) { config_lua($1) } else { usage(); exit 1 } } - -open (LOG, ">$configure_log") || die "cannot write configure.log: $!"; - # check for various executables and versions. Only update variable if # it is not already set. # diff -ur qc--20060131.orig/doc/mkfile qc--20060131/doc/mkfile --- qc--20060131.orig/doc/mkfile 2005-11-07 01:41:21.000000000 +0100 +++ qc--20060131/doc/mkfile 2006-02-02 00:38:00.000000000 +0100 @@ -92,7 +92,7 @@ # and accessible from Lua as This.manual. qc--.man:D: qc--.1 - GROFF_NO_SGR=1 nroff -man -Tascii qc--.1 | ul -t dump > $target + GROFF_NO_SGR=1 nroff -man -Tascii qc--.1 > $target release.tex:D: release.nw noweave -delay $prereq > $target diff -ur qc--20060131.orig/mkfile qc--20060131/mkfile --- qc--20060131.orig/mkfile 2005-07-01 22:29:52.000000000 +0200 +++ qc--20060131/mkfile 2006-02-02 19:15:53.000000000 +0100 @@ -97,7 +97,7 @@ cd test2 && NPROC=1 mk $MKFLAGS all test.opt:V: all.opt - cd test2 && NPROC=1 mk QC=../bin/qc--.opt $MKFLAGS all + cd test2 && NPROC=1 mk $MKFLAGS QC=../bin/qc--.opt all coverage: test2/ocamlprof.dump rm -f $target