Files
mercury/scripts/mnl.in
Fergus Henderson 62377e8bf2 Fix a portability problem: ULTRIX's /bin/sh does not understand
Estimated hours taken: 0.5

scripts/{c2init,mnc,mnl,msc,msl}.in:
	Fix a portability problem: ULTRIX's /bin/sh does not understand
	`shift 2', so I've replaced all occurrences of this with
	`shift; shift'.  (Thanks to Jeff Schultz for the bug report.)
1996-05-13 06:12:48 +00:00

73 lines
1.5 KiB
Bash

#! /bin/sh
# @configure_input@
#---------------------------------------------------------------------------#
# Copyright (C) 1995 University of Melbourne.
# This file may only be copied under the terms of the GNU General
# Public License - see the file COPYING in the Mercury distribution.
#---------------------------------------------------------------------------#
# mnl - Mercury NU-Prolog Linker.
#
# Links NU-Prolog object files together with the Mercury library
# to produce an executable binary.
#
# Usage: mnl [-v|--verbose] [-d|--debug] [<nc link options>] files...
#
# Environment variables: MERCURY_LIB_DIR, MERCURY_LIB_OBJS
NULIBDIR=${MERCURY_NU_LIB_DIR=@LIBDIR@/nuprolog/@FULLARCH@}
LIBRARY_OBJS=${MERCURY_NU_LIB_OBJS=" `cd $NULIBDIR; echo *.no` "}
debug_objs="portray.no debug.no error.no"
options=
verbose=false
debug=false
while true; do
case "$1" in
-v|--verbose)
verbose=true
shift
;;
-d|--debug)
debug=true
shift
;;
-e|-u|-o|-F)
options="$options $1 $2"
shift; shift
;;
-*) options="$options $1"
shift
;;
*) break 2
;;
esac
done
objlist=
for obj in $LIBRARY_OBJS; do
if echo "" "$@" "$debug_objs " | grep " $obj " > /dev/null; then
true
else
objlist="$objlist $NULIBDIR/$obj"
fi
done
if $debug; then
for obj in $debug_objs; do
if echo "" "$@" "" | grep " $obj " > /dev/null; then
true
else
objlist="$objlist $NULIBDIR/$obj"
fi
done
fi
if $verbose; then
echo nc $options $objlist "$@"
fi
case $# in
0) exec nc $options $objlist ;;
*) exec nc $options $objlist "$@" ;;
esac