home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- #
- # libtool
- #
- # written by Mike Gobbi
- # created July 10, 1995
- #
- # Copyright (C) 1995 NeXT Computer, Inc.
- # All Rights Reserved
- #
-
- mode=dynamic
- ifiles=
- soptions=""
- doptions=""
- output_specified=no
- output_file=
- arch=
- deffile=
- verbose=no
- CC=gcc
- LIB="lib /nologo"
-
- while true
- do
- case $1 in
-
- -static )
- mode=static
- shift
- ;;
-
- -dynamic )
- mode=dynamic
- shift
- ;;
-
- -o )
- soptions="$soptions /OUT:$2"
- doptions="$doptions -o $2"
- output_specified=yes
- output_file="$2"
- shift
- shift
- ;;
-
- -[sac] | -[sac][sac] | -[sac][sac][sac] )
- echo "libtool: warning: -sac options ignored" 1>&2
- shift
- ;;
-
- -g )
- doptions="$doptions -g"
- shift
- ;;
-
- -def )
- deffile="$2"
- shift
- shift
- ;;
-
- -file[lL]ist )
- if [ "$mode" = "dynamic" ]
- then
- doptions="$doptions -filelist $2"
- else
- file=`echo $2 | sed "s/,.*//g"`
- if echo $2 | grep -s ,
- then
- dir=`echo $2 | sed "s/.*,//g"`
- else
- dir=
- fi
- if [ ! -r "$file" ]
- then
- echo "libtool: error: filelist '$2' not found" 1>&2
- exit 1
- elif [ -n "$dir" ]
- then
- ifiles="$ifiles `cat $file | sed "s@^@$dir/@" | tr -s '\012\015 ' ' '`"
- else
- ifiles="$ifiles `cat $file | tr -s '\012\015 ' ' '`"
- fi
- fi
- shift
- shift
- ;;
-
- -install_name )
- echo "libtool: warning: -install_name ignored" 1>&2
- shift
- shift
- ;;
-
- -compatibility_version )
- echo "libtool: warning: -compatibility_version ignored" 1>&2
- shift
- shift
- ;;
-
- -current_version )
- echo "libtool: warning: -current_version ignored" 1>&2
- shift
- shift
- ;;
-
- -v )
- verbose=yes
- soptions="$soptions /VERBOSE"
- doptions="$doptions"
- shift
- ;;
-
- -seg1addr | -undefined )
- echo "libtool: warning: option '$1 $2' suppressed" 1>&2
- shift
- shift
- ;;
-
- -image_base )
- doptions="$doptions -Xlinker /BASE:$2"
- shift
- shift
- ;;
-
- -sectorder )
- echo "libtool: warning: option '$1 $2 $3 $4' suppressed" 1>&2
- shift
- shift
- shift
- shift
- ;;
-
- -sectorder_detail )
- echo "libtool: warning: option '$1' suppressed" 1>&2
- shift
- ;;
-
- -t )
- shift
- ;;
-
- - )
- shift
- break
- ;;
-
- -framework )
- doptions="$doptions -framework $2"
- shift
- shift
- ;;
-
- -F* )
- doptions="$doptions $1"
- shift
- ;;
-
- -arch* )
- doptions="$doptions -arch $2"
- arch="$2"
- shift
- shift
- ;;
-
- -* )
- soptions="$soptions $1"
- doptions="$doptions $1"
- shift
- ;;
-
- * )
- break
- ;;
-
- esac
- done
-
- if [ -n "$deffile" ]
- then
- if [ ! -r "$deffile" ]
- then
- echo "libtool: error: definition file $deffile is missing" 1>&2
- exit 1
- fi
- elif [ -n "$output_file" -a -n "$arch" ]; then
- deffile=`echo $output_file | sed -e 's/\.dll$//' -e "s/\.$arch//" -e "s@.*/@@"`.def
- else
- deffile=`echo $output_file | sed -e 's/\.dll$//'`.def
- #deffile="$output_file"
- fi
-
- ifiles="$ifiles $*"
-
- if [ "$output_specified" = "no" ]
- then
- echo "libtool: error: -o option is required" 1>&2
- exit 1
- elif [ "$mode" = "static" ]
- then
- if [ "$verbose" = "yes" ]
- then
- echo $LIB $soptions $ifiles
- fi
- $LIB $soptions $ifiles
- exit $?
- elif [ "$mode" = "dynamic" ]
- then
- if [ -r $deffile ]
- then
- cmd="$CC -dll $doptions $ifiles -Xlinker -DEF:$deffile"
- else
- echo "libtool: warning: default definition file $deffile is missing" 1>&2
- cmd="$CC -dll $doptions $ifiles"
- fi
- if [ "$verbose" = "yes" ]
- then
- echo $cmd
- fi
- $cmd
- exit $?
- else
- echo "libtool: error: unknown mode $mode" 1>&2
- exit 1
- fi
-