[m-dev.] For review: "Absolutify" relative paths for shared libraries

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Jun 30 18:40:19 AEST 1999


On 30-Jun-1999, Warwick Harvey <wharvey at cs.monash.edu.au> wrote:
> scripts/ml.in:
> 	If a shared library directory given to `ml' is relative, turn it
> 	into an absolute path by prepending the current directory.  Also
> 	add an option `--leave-shared-lib-dirs-relative' to `ml' which
> 	turns off this behaviour, in case the user does actually want a
> 	relative path.
...
> +	--leave-shared-lib-dirs-relative)
> +		leave_shlib_dirs_relative=true
> +		;;

You should also add

	--no-leave-shared-lib-dirs-relative)
		leave_shlib_dirs_relative=false
		;;

so that this option can be disabled.

>  	-R|--shared-lib-dir)
>  		dir="$2"
> +		case $leave_shlib_dirs_relative in false)
> +			dir="`expr $dir : '\(/.*\)' '|' $PWD/$dir`"
> +			;;
> +		esac

`$PWD' is a bash-ism.  It's not portable.

It would be more efficient to use `case' rather than `expr' here
(saves a process invocation):

			case "$dir" in
				/*) ;;
				*)  dir="`pwd`/$dir" ;;
			esac

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list