--- metamail-2.7.orig/bin/showaudio
+++ metamail-2.7/bin/showaudio
@@ -1,6 +1,4 @@
-#!/bin/csh -fb
-# (The "-fb" might need to be changed to "-f" on some systems)
-#
+#!/bin/sh -e
 # Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
 # 
 # Permission to use, copy, modify, and distribute this material 
@@ -13,200 +11,309 @@
 # MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
 # OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
 # WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
-#
 
+# Conversion from C shell to Bourne shell by Z-Code Software Corp.
+# Conversion Copyright (c) 1992 Z-Code Software Corp.
+# Permission to use, copy, modify, and distribute this material
+# for any purpose and without fee is hereby granted, provided
+# that the above copyright notice and this permission notice
+# appear in all copies, and that the name of Z-Code Software not
+# be used in advertising or publicity pertaining to this
+# material without the specific, prior written permission
+# of an authorized representative of Z-Code.  Z-CODE SOFTWARE
+# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
+# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
+# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
 
-if (! $?METAMAIL_TMPDIR) then
-    set METAMAIL_TMPDIR=/tmp
-endif
-
-# First, figure out which machine to play it on!
-set thishost=`hostname`
-
-# Note that there are some special lines in here that only work at Bellcore,
-# Specifically involving phone playback from the machine "greenbush".
-# Everything should work fine at other sites, though
-set AUDIOBINDIR=/u/andrew/phone-sau/bin
-set AUDIOPHONEHOST=greenbush
-set AUDIOPHONEHOSTLONG=greenbush.bellcore.com
-set AUDIOLOGMAIL=andrew@thumper.bellcore.com
-set ORG="Bellcore"
-set STDINPUT=0
-if ("$1" == "-p") then
-    set AUDIOPHONE=$2
-    shift
-    shift
-endif
-if ("$1" == "-s") then
-    set AUDIOSPEAKERFORCE = 1
-    shift
-endif
-if ($?AUDIOPHONE || $?AUDIOPHONEFORCE) then
-    goto playphone
-endif
-if (! -d $AUDIOBINDIR) then
-    set AUDIOSPEAKERFORCE=1
-endif
-
-if ("$1" == "-") then
-    set STDINPUT=1
-    shift
-endif
-if ($#argv < 1) then
-    set STDINPUT=1
-endif
-	
-if (! $STDINPUT && ! $?AUDIOSPEAKERFORCE && ! $?AUDIOPHONEFORCE) then
-    if ($?MM_NOTTTY) then
-	if ($MM_NOTTTY == 1) then
-	    setenv MM_NOTTTY 0
-	    xterm -e showaudio $*
-	    exit 0
-	endif
-    endif
-choosehardware:
-    echo This program can display audio on the speakers of some workstations, 
-    echo "or (at some sites) it can call you on the telephone.  Please choose one:"
-    echo ""
-    echo "1 -- Use the computer's speaker"
-    echo "2 -- Call me on the telephone"
-    echo ""
-    echo -n "Which do you prefer (1 or 2)? "
-    set ans=$<
-    if ($ans == 2)  then
-	echo "OK, we'll use the telephone..."
-	set AUDIOPHONEFORCE=1
-	echo "In the future, you can avoid this question by setting the environment variable"
-	echo "AUDIOPHONEFORCE to 1"
-	goto playphone
-    else if ($ans == 1) then
-    	echo "OK, Attempting to play the audio using your computer's speaker.."
-    	set AUDIOSPEAKERFORCE=1
-	echo "In the future, you can avoid this question by setting the environment variable"
-	echo "AUDIOSPEAKERFORCE to 1"
-    else
-	echo "That is NOT one of your choices."
-	goto choosehardware
-    endif
-endif
-
-set audiohost=$thishost
-if ($?DISPLAY) then
-    set audiohost=`echo $DISPLAY | sed -e 's/:.*//'`
-    if ($audiohost == "unix") set audiohost=$thishost
-    if ($audiohost == "") set audiohost=$thishost
-endif
-if ($?AUDIOHOST) then
-	set audiohost=$AUDIOHOST
-endif
-
-if ($audiohost != $thishost) then
-    echo Sending audio to $audiohost...
-    if ($?MMS_AUDIO) then
-        if ($STDINPUT) then
-            cat | mms -host $audiohost "show audio/basic" -
-        else
-            cat $* | mms -host $audiohost "show audio/basic" -
-        endif
-        exit 0
-    endif
-
-# The next two lines are very inefficient, but not everyone has their path right for an rsh
-    pushd ~ >& /dev/null
-    set thisprog=`which showaudio`
-    popd >& /dev/null
-    if ($STDINPUT) then
-        cat | rsh $audiohost $thisprog -s -
-    else
-        cat $* | rsh $audiohost $thisprog  -s -
-    endif
-    exit 0
-endif
-
-if (-f /usr/sbin/sfplay) then
-    if ($#argv >= 1) then
-	exec /usr/sbin/sfplay -i mu-law chan 1 rate 8000 end $*
-    else
-	cat > ${METAMAIL_TMPDIR}/audio.$$
-	/usr/sbin/sfplay -i mu-law chan 1 rate 8000 end ${METAMAIL_TMPDIR}/audio.$$
-	rm ${METAMAIL_TMPDIR}/audio.$$
-	exit 0
-    endif
-else if (-d /usr/sony) then
-    set dev=/dev/sb0
-else if (-e /usr/bin/audioplay) then
-#  Solaris 2.0
-    /usr/bin/audioconvert -i raw,voice -f sun $* | /usr/bin/audioplay
-    exit $status
-else if (-e /bin/audioplay) then
-#  Solaris 2.0
-    /bin/audioconvert -i raw,voice -f sun $* | /bin/audioplay
-    exit $status
-else
-    set dev=/dev/audio
-endif
-
-if (-w $dev) then
-echo Playing audio on $thishost using $dev, one moment please...
-if ($#argv >= 1) then
-        cat $* > $dev
+# Brought into line with metamail 2.7 beta release Csh version
+# Added sox support
+#    Dave Shield	February 1994
+
+thishost=`hostname`
+
+AUDIOBINDIR=/u/andrew/phone-sau/bin
+AUDIOPHONEHOST=greenbush
+AUDIOPHONEHOSTLONG=greenbush.bellcore.com
+AUDIOLOGMAIL=greenbush.bellcore.com
+ORG=Bellcore
+STDINPUT=0
+
+if test -x /usr/bin/remsh
+then
+			# Probably a System V based system
+			#  "rsh" is likely to be "restricted shell"
+	RSH=remsh
 else
-        cat > $dev
-endif
-exit 0
-endif
+	RSH=rsh
+fi
+# SOX=/usr/remote/bin9/sox
+
+if test "$1" = "-p"
+then
+	AUDIOPHONE=$2
+	shift
+	shift
+fi
+
+if test "$1" = "-s"
+then
+	AUDIOSPEAKERFORCE=1
+	shift
+fi
+
+playphone=0
+if test ! -z "${AUDIOPHONE:-}" -o ! -z "${AUDIOPHONEFORCE:-}"
+then
+	playphone=1
+fi
+
+if test $playphone -eq 0
+then
+	if test ! -d "$AUDIOBINDIR"
+	then
+		AUDIOSPEAKERFORCE=1
+	fi
+
+	if test "$1" = "-"
+	then
+		STDINPUT=1
+		shift
+	fi
+	if test $# -eq 0
+	then
+		STDINPUT=1
+	fi
+
+	if test $STDINPUT -eq 0 -a -z "${AUDIOSPEAKERFORCE:-}" -a -z "${AUDIOPHONEFORCE:-}"
+	then
+		if test ! -z "${MM_NOTTTY:-}"
+		then
+			if test $MM_NOTTTY -eq 1
+			then
+				MM_NOTTTY=0; export MM_NOTTTY
+				xterm -e showaudio $*
+				exit 0
+			fi
+		fi
+		looping=1
+		while test $looping -eq 1
+		do
+		    echo This program can display audio on the speakers of some workstations, 
+		    echo "or (at some sites) it can call you on the telephone.  Please choose one:"
+		    echo ""
+		    echo "1 -- Use the computer's speaker"
+		    echo "2 -- Call me on the telephone"
+		    echo ""
+		    echo -n "Which do you prefer (1 or 2)? [1] "
+		    read ans
+		    if test "$ans" -eq 2
+		    then
+			echo "OK, we'll use the telephone..."
+			AUDIOPHONEFORCE=1
+			echo "In the future, you can avoid this question by setting the environment variable"
+			echo "AUDIOPHONEFORCE to 1"
+			playphone=1
+			looping=0
+		    elif test "$ans" -eq 1
+		    then
+			echo "OK, Attempting to play the audio using your computer's speaker.."
+			AUDIOSPEAKERFORCE=1
+			echo "In the future, you can avoid this question by setting the environment variable"
+			echo "AUDIOSPEAKERFORCE to 1"
+			looping=0
+		    else
+			echo "That is NOT one of your choices."
+		    fi
+		done
+	fi
+fi
+
+if test $playphone -eq 0
+then
+	audiohost=$thishost
+	if test ! -z "${DISPLAY:-}"
+	then
+		audiohost=`echo $DISPLAY | sed -e 's/:.*//'`
+		if test "$audiohost" = unix -o "$audiohost" = localhost
+		then
+			audiohost=$thishost
+		fi
+		if test -z "$audiohost"
+		then
+			audiohost=$thishost
+		fi
+	fi
+	if test ! -z "${AUDIOHOST:-}"
+	then
+		audiohost=$AUDIOHOST
+	fi
+
+	if test ! "$audiohost" = "$thishost"
+	then
+		echo Sending audio to $audiohost...
+		if test ! -z "${MMS_AUDIO}"
+		then
+			if test $STDINPUT -eq 1
+			then
+				cat | mms -host $audiohost "show audio/basic"
+			else
+				cat $* | mms -host $audiohost "show audio/basic"
+			fi
+			exit 0
+		fi
+		thisprog=`(cd; which showaudio)`
+		if test $STDINPUT -eq 1
+		then
+			cat | $RSH $audiohost $thisprog -s
+		else
+			cat $* | $RSH $audiohost $thisprog -s
+		fi
+		exit 0
+	fi
+
+
+	if test -f /usr/sbin/sfplay
+	then
+		if test $# -ne 0
+		then
+			exec /usr/sbin/sfplay -i mu-law chan 1 rate 8000 end $*
+		else
+			fname=$(mktemp /tmp/audio.XXXXXX)
+			cat > $fname
+			/usr/sbin/sfplay -i mu-law chan 1 rate 8000 end $fname
+			rm $fname
+			exit 0
+		fi
+	elif test -f /usr/bin/audioplay
+	then
+	# Solaris 2.0
+		/usr/bin/audioconvert -i raw,voice -f sun $* | /usr/bin/audioplay
+		exit $?
+	elif test -f /bin/audioplay
+	then
+	# Solaris 2.0
+		/bin/audioconvert -i raw,voice -f sun $* | /bin/audioplay
+		exit $?
+	elif test -d /usr/sony
+	then
+		dev=/dev/sb0
+	else
+		dev=/dev/audio
+	fi
 
-playphone:
-if (-d $AUDIOBINDIR) then
-              set thisprog=`which showaudio`
-	if (! $?AUDIOPHONE) then
-	    if ($?MM_NOTTTY) then
-		if ($MM_NOTTTY == 1) then
-		    setenv MM_NOTTTY 0
-		    xterm -e $thisprog $*
-		    exit 0
-		endif
-	    endif
-	    echo This message contains audio, which can be sent to your telephone.
-	    echo Please enter the telephone number at which you would like to hear this
-	    echo -n "audio message as you would dial it from INSIDE ${ORG}:  "
-	    set AUDIOPHONE=$<
-	endif
-	if ($thishost == $AUDIOPHONEHOST || $thishost == $AUDIOPHONEHOSTLONG) then
-	    echo Calling Phone number $AUDIOPHONE
-	    echo "You MUST SAY HELLO when you answer the phone, or you will not hear the message."
-	    mail -s "showaudio: `whoami` called $AUDIOPHONE" $AUDIOLOGMAIL < /dev/null
-	    if ($STDINPUT) then
-	        cat $AUDIOBINDIR/../GREET.au $* - | $AUDIOBINDIR/play -\# $AUDIOPHONE -
-	    else
-	        cat $AUDIOBINDIR/../GREET.au $* | $AUDIOBINDIR/play -\# $AUDIOPHONE -
-	    endif
-	    echo All done
-	    exit 0
+	if test -w $dev
+	then
+		echo Playing audio on $thishost using $dev, one moment please...
+		if test $# -ne 0
+		then
+			if test ! -z "${SOX:-}"
+			then
+			    for ii in $*
+			    do
+#
+#  The "approved magic" to translate arbitary sounds
+#	to AU format is as follows:
+#
+#				$SOX -t auto $ii -c 1 -t aiff - | \
+#				$SOX -t aiff - -U -b -t au -c 1 -r 8000 $dev
+#
+#  But the following "direct" translation also seems to work
+				$SOX -t auto $ii -c 1 -t au -c 1 -r 8000 $dev
+			    done
+			else
+				cat $* > $dev
+			fi
+		else
+			if test ! -z "${SOX:-}"
+			then
+				fname=$(mktemp /tmp/audio.XXXXXX)
+				cat > $fname
+#
+#  See also above
+#
+				$SOX -t auto $fname -c 1 -t au -c 1 -r 8000 $dev
+				rm $fname
+			else
+				cat > $dev
+			fi
+		fi
+		exit 0
+	fi
+fi
+
+if test -d "$AUDIOBINDIR"
+then
+	thisprog=`which showaudio`
+	if test -z "${AUDIOPHONE:-}"
+	then
+		if test ! -z "${MM_NOTTTY:-}"
+		then
+			if test $MM_NOTTTY -eq 1
+			then
+				MM_NOTTTY=0; export MM_NOTTTY
+				xterm -e $thisprog $*
+				exit 0
+			fi
+		fi
+		echo This message contains audio, which can be sent to your telephone.
+		echo Please enter the telephone number at which you would like to hear this
+		echo -n "audio message as you would dial it from inside ${ORG}: "
+		read AUDIOPHONE
+	fi
+
+	if test "$thishost" == "$AUDIOPHONEHOST" \
+		-o "$thishost" == "$AUDIOPHONEHOSTLONG"
+	then
+		echo Calling Phone number $AUDIOPHONE
+		echo "You MUST SAY HELLO when you answer the phone, or you will not hear the message."
+		mail -s "showaudio: `whoami` called $AUDIOPHONE" $AUDIOLOGMAIL < /dev/null
+		if test $STDINPUT -eq 1
+		then
+			cat $AUDIOBINDIR/../GREET.au $* - | $AUDIOBINDIR/play -\# $AUDIOPHONE -
+		else
+			cat $AUDIOBINDIR/../GREET.au $* | $AUDIOBINDIR/play -\# $AUDIOPHONE -
+		fi
+		echo All done
+		exit 0
 	else
-	    echo Trying to rsh to $AUDIOPHONEHOST to send audio via telephone
-	    cat $* | rsh $AUDIOPHONEHOST $thisprog -p $AUDIOPHONE -
-	    exit 0
-	endif
-endif
+		echo Trying to rsh to $AUDIOPHONEHOST to send audio via telephone
+		if test $STDINPUT -eq 1
+		then
+			cat $* - | $RSH $AUDIOPHONEHOST $thisprog -p $AUDIOPHONE -
+		else
+			cat $* | $RSH $AUDIOPHONEHOST $thisprog -p $AUDIOPHONE -
+		fi
+		exit 0
+	fi
+fi
 echo ""
-echo This message contains an audio mesage, which can not currently be
-echo played on this type of workstation.   If you log into an appropriate 
-echo "machine (currently a SPARCstations or Sony News workstation)"
-echo and read this message there, you should be able to hear the audio
-echo message.  
+echo "This message contains an audio mesage, which can not currently be"
+echo "played on this type of workstation.   If you log into an appropriate"
+echo "machine (currently a SPARCstation or Sony News workstation)"
+echo "and read this message there, you should be able to hear the audio"
+echo "message."
 echo ""
-if (! $?MM_NOTTTY) set MM_NOTTTY=0
-if ($MM_NOTTTY == 1) then
-    set fname=/tmp/mm.aud.$$
+
+if test -z "${MM_NOTTY:-}"
+then
+	MM_NOTTY=0
+fi
+if test $MM_NOTTY -eq 1
+then
+	fname=$(mktemp /tmp/metamail.XXXXXX)
 else
-    echo -n "Do you want to write the audio out to a file [y] ? "
-    set ANS=$<
-    if ("$ANS" =~ n* ||  "$ANS" =~ N* ) exit 0
-    echo -n "File name:"
-    set fname=$<
-endif
-cp $1 $fname
-if ($status == 0) echo Wrote raw audio file: $fname
+	echo -n "Do you want to write the audio out to a file [y] ? "
+	read ANS
+	case "$ANS" in
+		[Nn]*)	exit 0 ;;
+	esac
+
+	echo -n "File name:"
+	read fname
+fi
+cp "$1" "$fname"
+if test $? -eq 0
+then
+	echo Wrote raw audio file: "$fname"
+fi
 exit 0
-
--- metamail-2.7.orig/bin/showpicture
+++ metamail-2.7/bin/showpicture
@@ -1,6 +1,4 @@
-#!/bin/csh -fb
-# (The "-fb" might need to be changed to "-f" on some systems)
-#
+#!/bin/sh -e
 # Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
 # 
 # Permission to use, copy, modify, and distribute this material 
@@ -13,84 +11,111 @@
 # MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
 # OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
 # WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
-#
 
-if (! $?METAMAIL_TMPDIR) then
-    set METAMAIL_TMPDIR=/tmp
-endif
-
-if (! $?X_VIEWER) then
-set X_VIEWER="xloadimage -view -quiet -geometry +1+1"
-# set X_VIEWER="xv -geometry +1+1"
-endif
-if ($1 == "-viewer" && $#argv > 1) then
-    set X_VIEWER = "$2"
-    shift
-    shift
-endif
-
-if (! $?MM_NOTTTY) then
-    set MM_NOTTTY=0
-endif
-if (! $?DISPLAY) then
-    echo ""
-    echo This message contains a picture, which can currently only be
-    echo viewed when running X11.  If you read this message while running
-    echo X11, and have your DISPLAY variable set, you will then
-    echo be able to see the picture properly.
-    echo ""
-    if ($MM_NOTTTY) then
-        set fname=${METAMAIL_TMPDIR}/sp.$$
-        echo "The picture is being automatically stored in the file $fname"
-        echo "If you do not want this file, please delete it."
-    else
-        echo -n "Do you want to write the picture out to a file [y] ? "
-        set ANS=$<
-        if ("$ANS" =~ n* ||  "$ANS" =~ N* ) exit 0
-        while ( 1 == 1)
-            echo -n "File name:"
-            set fname=$<
-            if (! -f $fname) then
-                break
-            else
-                echo "$fname already exists. Try again"
-            endif
-        end
-    endif
-    cp $1 $fname
-    if ($status == 0) echo Wrote file $fname
-    exit 0
-endif
-
-if ($#argv == 0) then
-    set SQUIRREL=${METAMAIL_TMPDIR}/sp.$$
-    cat > $SQUIRREL
-else
-    set SQUIRREL="$*"
-endif
+# Conversion from C shell to Bourne shell by Z-Code Software Corp.
+# Conversion Copyright (c) 1992 Z-Code Software Corp.
+# Permission to use, copy, modify, and distribute this material
+# for any purpose and without fee is hereby granted, provided
+# that the above copyright notice and this permission notice
+# appear in all copies, and that the name of Z-Code Software not
+# be used in advertising or publicity pertaining to this
+# material without the specific, prior written permission
+# of an authorized representative of Z-Code.  Z-CODE SOFTWARE
+# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
+# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
+# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+
+# Brought into line with metamail 2.7 beta release Csh version
+#    Dave Shield	February 1994
 
-echo NOTE:  TO MAKE THE PICTURE WINDOW GO AWAY, JUST TYPE 'q' IN IT.
-if ($#argv == 0) then
-    echo "==> TO SAVE THIS IMAGE, COPY THE FILE $SQUIRREL BEFORE EXITING"
-    echo ""
-    $X_VIEWER $SQUIRREL
-    rm $SQUIRREL
+if test -z "${X_VIEWER:-}"
+then
+	X_VIEWER="xloadimage -view -quiet"
+# X_VIEWER="xv"
+fi
+
+if test "$1" = "-viewer" -a ! -z "$2"
+then
+	X_VIEWER=$2
+	shift
+	shift
+fi
+
+if test -z "${MM_NOTTY:-}"
+then
+	MM_NOTTY=0
+fi
+if test -z "${DISPLAY:-}"
+then
+	echo ""
+	echo This message contains a picture, which can currently only be
+	echo viewed when running X11.  If you read this message while running
+	echo X11, you will be able to see the picture properly.
+	if test $MM_NOTTY -eq 1
+	then
+		fname=$(mktemp /tmp/metamail.XXXXXX)
+		echo "The picture is being automatically stored in the file $fname"
+		echo "If you do not want this file, please delete it."
+	else
+		echo -n "Do you want to write the picture out to a file [y] ? "
+		read ANS
+		case "$ANS" in
+		    [Nn]*)	exit 0;;
+		    *)	looping=1
+			while test $looping -eq 1
+			do
+				echo -n "File name: "
+				read fname
+				if test -f "$fname"
+				then
+					echo "$fname already exists. Try again"
+				else
+					looping=0
+				fi
+			done ;;
+		esac
+	fi
+	cp "$1" "$fname"
+	if test $? -eq 0
+	then
+		echo Wrote file "$fname"
+	fi
+	exit 0
+fi
+
+if test -z "$1"
+then
+	SQUIRREL=$(mktemp /tmp/metamail.XXXXXX)
+	cat > $SQUIRREL
 else
+	SQUIRREL="$*"
+fi
 
-foreach i ($*)
-    echo "==> TO SAVE THIS IMAGE, COPY THE FILE $i BEFORE EXITING"
-    echo ""
-    set dir=$i:h
-    if ($dir != $i) then
-	# Make the ln sure to work	
-	cd $dir
-    endif
-    ln $i $$.PRESS-q-TO-EXIT 
-    if (! $status) then 
-        sh -c "$X_VIEWER $$.PRESS-q-TO-EXIT"
-        rm $$.PRESS-q-TO-EXIT 
-    else
-        sh -c "$X_VIEWER $i"
-    endif
-end
-endif
+
+echo NOTE: TO MAKE THE PICTURE WINDOW GO AWAY, JUST TYPE 'q' IN IT.
+if test -z "$1"
+then
+	echo "==> TO SAVE THIS IMAGE, COPY THE FILE $SQUIRREL BEFORE EXITING"
+	echo
+	$X_VIEWER $SQUIRREL
+	rm $SQUIRREL
+else
+	for i in $SQUIRREL
+	do
+		echo "==> TO SAVE THIS IMAGE, COPY THE FILE $i BEFORE EXITING"
+		echo
+		dir=$(dirname $i)
+		base=$(basename $i)
+		if test ! "$base" = "$i"
+		then
+			cd $dir
+		fi
+		if ln $i $$.PRESS-q-TO-EXIT  > /dev/null 2>&1
+		then
+		    $X_VIEWER $$.PRESS-q-TO-EXIT
+		    rm $$.PRESS-q-TO-EXIT 
+		else
+		    $X_VIEWER $i
+		fi
+	done
+fi
--- metamail-2.7.orig/bin/metasend
+++ metamail-2.7/bin/metasend
@@ -1,6 +1,4 @@
-#!/bin/csh -fb
-# (The "-fb" might need to be changed to "-f" on some systems)
-#
+#!/bin/sh -e
 # Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
 # 
 # Permission to use, copy, modify, and distribute this material 
@@ -13,487 +11,591 @@
 # MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
 # OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
 # WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
-#
 
-if (! $?METAMAIL_TMPDIR) then
-    set METAMAIL_TMPDIR=/tmp
-endif
-
-set hname = `hostname`
-set idctr=0
-set MustDelete=0
-set batchmode=0
-set multipart = 1
-if ($?SPLITSIZE) then
-    set splitsize=$SPLITSIZE
+# Conversion from C shell to Bourne shell by Z-Code Software Corp.
+# Conversion Copyright (c) 1992 Z-Code Software Corp.
+# Permission to use, copy, modify, and distribute this material
+# for any purpose and without fee is hereby granted, provided
+# that the above copyright notice and this permission notice
+# appear in all copies, and that the name of Z-Code Software not
+# be used in advertising or publicity pertaining to this
+# material without the specific, prior written permission
+# of an authorized representative of Z-Code.  Z-CODE SOFTWARE
+# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
+# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
+# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+
+# Brought into line with metamail 2.7 beta release Csh version
+#    Dave Shield	February 1994
+
+hname=`hostname`
+idctr=0
+MustDelete=0
+batchmode=0
+multipart=1
+if test ! -z "${SPLITSIZE:-}"
+then
+	splitsize=$SPLITSIZE
 else
-    set splitsize = 100000
-endif
-set outputfile = ""
-set multipartsubtype = "mixed"
-set cdescrip = "An object packed by metasend"
-set isentity=0
-set newid=`date | tr " :" "__"`
-set cid="<${newid}_$idctr@${hname}>"
-@ idctr++
-
-while ($#argv > 0)
-    switch ("$1")
-        case "-S":
-            shift
-            if ($#argv == 0) then
-                echo "-S requires a following argument, the SPLIT threshhold"
-                exit -1
-            endif
-            set splitsize=$1
-            shift
-            breaksw
-        case "-b":
-            # Batch mode -- ALL args must be on command line
-            set batchmode = 1
-            shift
-            breaksw
-        case "-c":
-            shift
-            if ($#argv == 0) then
-                echo "-c requires a following argument, the CC address"
-                exit -1
-            endif
-            set cc="$1"
-            shift
-            breaksw
-        case "-i":
-            shift
-            if ($#argv == 0) then
-                echo "-i requires a following argument, the Content-ID value"
-                exit -1
-            endif
-            set cid=$1
-            shift
-            breaksw
-        case "-I":
-            shift
-            if ($#argv == 0) then
-                echo "-I requires a following argument, the multipart Content-ID value"
-                exit -1
-            endif
-            set multicid=$1
-            shift
-            breaksw
-        case "-s":
-            shift
-            if ($#argv == 0) then
-                echo "-s requires a following argument, the SUBJECT"
-                exit -1
-            endif
-            set subject="$1"
-            shift
-            breaksw
-        case "-t":
-            shift
-            if ($#argv == 0) then
-                echo "-t requires a following argument, the TO address"
-                exit -1
-            endif
-            set to="$1"
-            shift
-            breaksw
-        case "-F":
-            shift
-            if ($#argv == 0) then
-                echo "-F requires a following argument, the FROM address"
-                exit -1
-            endif
-            set from="$1"
-            shift
-            breaksw
-        case "-P":
-            shift
-            if ($#argv == 0) then
-                echo "-P requires a following argument, the preamble file name"
-                exit -1
-            endif
-            set preamblefile="$1"
-            shift
-            breaksw
-        case "-e":
-            shift
-            if ($#argv == 0) then
-                echo "-e requires a following argument, the ENCODING value"
-                exit -1
-            endif
-            set encode=$1
-            if ($encode == "base64") then
-	    set encodingprog = "mimencode -b"
-            else if ($encode == "x-uue") then
-	        set encodingprog = "uuencode mail-body"
-            else if ($encode == "7bit") then
-	        set encodingprog = cat
-           else
-	        set encodingprog = "mimencode -q"
-	        set encode = "quoted-printable"
-           endif 
-           shift
-            breaksw
-        case "-f":
-            shift
-            if ($#argv == 0) then
-                echo "-f requires a following argument, the DATA FILE"
-                exit -1
-            endif
-            set datafile=$1
-            if (! -e  $datafile) then
-                echo The file $datafile does not exist.
-                exit -1
-            endif
-            shift
-            breaksw
-        case "-m":
-            shift
-            if ($#argv == 0) then
-                echo "-m requires a following argument, the MIME CONTENT-TYPE"
-                exit -1
-            endif
-#            set ctyperaw = $1
-#            set  ctype=`echo $ctyperaw | tr \" \'`
-	set ctype = "$1"
-	if (`echo $ctype | grep /` == "") then
-	    echo "Invalid content-type specified"
-	    exit -1
-	endif
-            shift
-            breaksw
-        case "-o":
-            shift
-            if ($#argv == 0) then
-                echo "-o requires a following argument, the output file name"
-                exit -1
-            endif
-            set outputfile="$1"
-            shift
-            breaksw
-        case "-/":
-            shift
-            if ($#argv == 0) then
-                echo "-/ requires a following argument, the multipart subtype"
-                exit -1
-            endif
-            set multipartsubtype="$1"
-            shift
-            breaksw
-        case "-D":
-            shift
-            if ($#argv == 0) then
-                echo "-D requires a following argument, the Content-Description value"
-                exit -1
-            endif
-            set cdescrip="$1"
-            shift
-            breaksw
-        case "-E":
-            set isentity=1
-            shift
-            breaksw
-        case "-z":
-            set MustDelete=1
-            shift
-            breaksw
-        case "-n":
-            if ($isentity) then
-              if (! $?encode) then 
-                set encode=7bit
-                set encodingprog=cat
-              endif
-              if (! $?ctype) then
-                  set ctype=bogus
-                  # Never used
-               endif
-	if ( ! $?datafile) then
-	    echo One part is incomplete -- each part needs at least -f and -E
-	    exit -1
-	endif
-            else 
-	if ( ! $?ctype || ! $?datafile) then
-	    echo One part is incomplete -- each part needs at least -f and -m
-	    exit -1
-	endif
-            endif
-	if (! $?encode) then
-	        if ("$ctype" =~ text*) then
-	              set encodingprog = "mimencode -q"
-		set encode = "quoted-printable"
-	        else
-	            set encode = base64
-	            set encodingprog = "mimencode -b"
-	        endif
-	endif
-	set ctype${multipart} = "$ctype"
-	set datafile${multipart} = $datafile
-	set encode${multipart} = $encode
-	set cdescrip${multipart} = "$cdescrip"
-	set cid${multipart} = "$cid"
-	set isentity${multipart} = $isentity
-	set encodingprog${multipart} = "$encodingprog"
-	unset ctype
-	unset datafile
-	unset encode
-	unset encodingprog
-	set newid=`date | tr " :" "__"`
-	set cid="<${newid}_$idctr@${hname}>"
-	@ idctr++
-	set cdescrip = "An object packed by metasend"
-	set isentity=0
-            @  multipart++
-	shift
-	breaksw
-        default:
-            echo UNRECOGNIZED METASEND OPTION: $1
-            exit -1
-    endsw
-end
-if ($batchmode == 0) then
-    if (! $?to) then
-        echo -n "To: "
-        set to = $<
-    endif
-    if (! $?subject) then
-        echo -n "Subject: "
-        set subject = $<
-    endif
-    if (! $?cc) then
-        echo -n "CC: "
-        set cc = $<
-    endif
-anotherpart:
-    if (! $?ctype) then
-        echo -n "Content-type: "
-#        set ctyperaw = $<
-#        set  ctype=`echo $ctyperaw | tr \" \'`
-        set ctype = "$<"
-    endif
-    if (`echo $ctype | grep /` == "") then
-        echo "Invalid content-type specified"
-        unset ctype
-        goto anotherpart
-    endif
-#    if ($ctype != $ctyperaw)  echo Double  quotes not allowed, using $ctype
-    if (! $?datafile) then
-        getfile:
-        echo -n "Name of file containing $ctype data: "
-        set datafile = $<
-        if (! -e  $datafile) then
-            echo The file $datafile does not exist.
-            goto getfile
-        endif
-    endif
-    if (! $?encode) then
-        retry:
-        echo "Do you want to encode this data for sending through the mail?"
-        echo "  1 -- No, it is already in 7 bit ASCII"
-        echo "  2 -- Yes, encode in base64 (most efficient)"
-        echo "  3 -- Yes, encode in quoted-printable (less efficient, more readable)"
-        echo "  4 -- Yes, encode it using uuencode (not standard, being phased out)"
-        set encode=$<
-        switch ("$encode")
-            case 1:
-                set encodingprog = cat
-	  set encode = 7bit
-                breaksw
-            case 2:
-                set encodingprog = "mimencode -b"
-	  set encode = base64
-                breaksw
-            case 3:
-                set encodingprog = "mimencode -q"
-	  set encode = quoted-printable
-                breaksw
-            case 4:
-                set encodingprog = "uuencode $datafile"
-	  set encode = x-uue
-                breaksw
-            default:
-                echo Unrecognized answer, please try again.
-                goto retry
-        endsw
-    endif
-    echo -n "Do you want to include another file too (y/n) [n] ? "
-    set ans=$<
-    if  ("$ans" =~ y*) then
-	set ctype${multipart} = "$ctype"
-	set datafile${multipart} = $datafile
-	set encode${multipart} = $encode
-	set encodingprog${multipart} = "$encodingprog"
-	set cdescrip${multipart} = "$cdescrip"
-	set cid${multipart} = "$cid"
-	set isentity${multipart} = $isentity
-	set cdescrip = "An object packed by metasend"
-	set isentity=0
-	unset ctype
-	unset datafile
-	unset encode
-	unset encodingprog
-	set newid=`date | tr " :" "__"`
-	set cid="<${newid}_$idctr@${hname}>"
-	@ idctr++
-            @  multipart++
-            goto anotherpart
-     endif
+	splitsize=100000
+fi
+
+ouputfile=
+multipartsubtype=mixed
+cdescrip=    # -Immi
+attachfilename=    # -Immi
+isentity=0
+newid=`date | tr " :" "__"`
+cid="<${newid}_$idctr@${hname}>"
+idctr=`expr $idctr + 1`
+
+while test ! -z "$*"
+do
+	case $1 in
+		-S) shift
+		    if test -z "$*"
+		    then
+			echo "-S requires a following argument, the SPLIT threshhold"
+			exit 1
+		    fi
+		    splitsize=$1
+		    shift ;;
+
+		-b) batchmode=1
+		    shift ;;
+
+		-c) shift
+		    if test -z "$*"
+		    then
+		    	echo "-c requires a following argument, the CC address"
+			exit 1
+		    fi
+		    cc=$1
+		    shift ;;
+
+		-i) shift
+		    if test -z "$*"
+		    then
+			echo "-i requires a following argument, the Content-ID value"
+			exit 1
+		    fi
+		    cid=$1
+		    shift ;;
+
+		-I) shift
+		    if test -z "$*"
+		    then
+			echo "-I requires a following argument, the multipart Content-ID value"
+			exit 1
+		    fi
+		    multicid=$1
+		    shift ;;
+
+		-s) shift
+		    if test -z "$*"
+		    then
+			echo "-s requires a following argument, the SUBJECT"
+			exit 1
+		    fi
+		    subject=$1
+		    shift ;;
+
+		-t) shift
+		    if test -z "$*"
+		    then
+			echo "-t requires a following argument, the TO address"
+			exit 1
+		    fi
+		    to=$1
+		    shift ;;
+
+		-F) shift
+		    if test -z "$*"
+		    then
+			echo "-F requires a following argument, the FROM address"
+			exit 1
+		    fi
+		    from=$1
+		    shift ;;
+
+		-P) shift
+		    if test -z "$*"
+		    then
+			echo "-P requires a following argument, the preamble file name"
+			exit 1
+		    fi
+		    preamblefile=$1
+		    shift ;;
+
+		-e) shift
+		    if test -z "$*"
+		    then
+			echo "-e requires a following argument, the ENCODING value"
+			exit 1
+		    fi
+		    encode=$1
+		    case "$encode" in
+			"base64")	encodingprog="mimencode -b";;
+			"x-uue")	encodingprog="uuencode \$datafile";;
+			"7bit")		encodingprog=cat;;
+			"8bit")		encodingprog=cat;;
+			*)		encodingprog="mimencode -q"
+					encode=quoted-printable ;;
+		    esac
+		    shift ;;
+
+		-f) shift
+		    if test -z "$*"
+		    then
+			echo "-f requires a following argument, the DATA FILE"
+			exit 1
+		    fi
+		    datafile=$1
+		    if test ! -r "$datafile"
+		    then
+			echo The file "$datafile" does not exist
+			exit 1
+		    fi
+		    shift ;;
+
+		-m) shift
+		    if test -z "$*"
+		    then
+			echo "-m requires a following argument, the MIME CONTENT-TYPE"
+			exit 1
+		    fi
+		    ctype=$1
+		    if test "`echo $ctype | grep /`" = ""
+		    then
+			echo Invalid content-type specified
+			exit 1
+		    fi
+		    shift ;;
+
+		-o) shift
+		    if test -z "$*"
+		    then
+			echo "-o requires a following argument, the output file name"
+			exit 1
+		    fi
+		    outputfile=$1
+		    shift ;;
+
+		-/) shift
+		    if test -z "$*"
+		    then
+			echo "-/ requires a following argument, the multipart subtype"
+			exit 1
+		    fi
+		    multipartsubtype=$1
+		    shift ;;
+
+		-D) shift
+		    if test -z "$*"
+		    then
+			echo "-D requires a following argument, the Content-Description value"
+			exit 1
+		    fi
+		    cdescrip=$1
+		    shift ;;
+
+# begin immi
+		-A) shift
+		    if test -z "$*"
+		    then
+			echo "-A requires a following argument, the attachment file name"
+			exit 1
+		    fi
+		    attachfilename=$1
+		    shift ;;
+#end immi
+
+		-E) isentity=1
+		    shift ;;
+
+		-z) MustDelete=1
+		    shift ;;
+
+		-n) if test $isentity -ne 0
+		    then
+			if test -z "${encode:-}"
+			then
+				encode=7bit
+				encodingprog=cat
+			fi
+			if test -z "${ctype:-}"
+			then
+				ctype=bogus
+				# Never used
+			fi
+			if test -z "${datafile:-}"
+			then
+				echo One part is incomplete -- each part needs at least -f and -E
+				exit 1
+			fi
+		    else
+			if test -z "${ctype:-}" || test -z "${datafile:-}"
+			then
+				echo One part is incomplete -- each part needs at least -f and -m
+				exit 1
+			fi
+		    fi
+		    if test -z "${encode:-}"
+		    then
+		    	case "$ctype" in
+				text*)	encodingprog="mimencode -q"
+					encode=quoted-printable ;;
+				*)	encodingprog="mimencode -b"
+					encode=base64 ;;
+			esac
+		    fi
+		    eval ctype${multipart}=\"$ctype\"
+		    eval datafile${multipart}=$datafile
+		    eval encode${multipart}=$encode
+		    eval cdescrip${multipart}=\"$cdescrip\"
+		    eval attachfilename${multipart}=\"$attachfilename\"   # -Immi
+		    eval cid${multipart}=\"$cid\"
+		    eval isentity${multipart}=$isentity
+		    eval encodingprog${multipart}=\"\$encodingprog\"
+
+		    ctype=
+		    datafile=
+		    encode=
+		    encodingprog=
+		    newid=`date | tr " :" "__"`
+		    cid="<${newid}_$idctr@${hname}>"
+		    idctr=`expr $idctr + 1`
+		    cdescrip=             # -Immi
+		    attachfilename=       # -Immi
+		    isentity=0
+		    multipart=`expr $multipart + 1`
+		    shift ;;
+
+		*) echo UNRECOGNIZED METASEND OPTION: "$1"
+		   exit 1 ;;
+	esac
+done
+
+if test $batchmode -eq 0
+then
+	if test -z "${to:-}"
+	then
+		echo -n "To: "
+		read to
+	fi
+	if test -z "${subject:-}"
+	then
+        	echo -n "Subject: "
+		read subject
+	fi
+	if test -z "${cc:-}"
+	then
+		echo -n "CC: "
+		read cc
+	fi
+
+	anotherpart=1
+	while test $anotherpart -eq 1
+	do
+	    looping=1
+	    while test $looping -ne 0
+	    do
+	        if test -z "${ctype:-}"
+	        then
+        		echo -n "Content-type: "
+			read ctype
+		fi
+		if test "`echo $ctype | grep /`" = ""
+		then
+			echo Invalid content-type specified
+			ctype=
+		else
+			looping=0
+		fi
+	    done
+	    if test -z "${datafile:-}"
+	    then
+		looping=1
+		while test $looping -eq 1
+		do
+			echo -n "Name of file containing $ctype data: "
+			read datafile
+			if test -r "$datafile"
+			then
+				looping=0
+			else
+				echo "The file $datafile does not exist."
+			fi
+		done
+	    fi
+
+	    if test -z "${encode:-}"
+	    then
+		looping=1
+		while test $looping -eq 1
+		do
+			echo "Do you want to encode this data for sending through the mail?"
+			echo "  1 -- No, it is already in 7 bit ASCII"
+			echo "  2 -- Yes, encode in base64 (most efficient)"
+			echo "  3 -- Yes, encode in quoted-printable (less efficient, more readable)"
+			echo "  4 -- Yes, encode it using uuencode (not standard, being phased out)"
+			echo "  5 -- No, it is 8 bit extended ASCII"
+			read encode
+			looping=0
+			case "$encode" in
+				1) encodingprog=cat
+				   encode=7bit ;;
+				2) encodingprog="mimencode -b"
+				   encode=base64 ;;
+				3) encodingprog="mimencode -q"
+				   encode=quoted-printable ;;
+				4) encodingprog="uuencode $datafile"
+				   encode=x-uue ;;
+ 				5) encodingprog=cat
+ 				   encode=8bit ;;
+				*) echo Unrecognized answer, please try again.
+				   looping=1 ;;
+			esac
+		done
+	    fi
+
+	    echo -n "Do you want to include another file too (y/n) [n] ? "
+	    read ans
+	    case $ans in
+		[Yy]*)	
+		    eval ctype${multipart}=\"$ctype\"
+		    eval datafile${multipart}=$datafile
+		    eval encode${multipart}=$encode
+		    eval encodingprog${multipart}=\"\$encodingprog\"
+		    eval cdescrip${multipart}=\"$cdescrip\"
+		    eval attachfilename${multipart}=\"$attachfilename\"   # -Immi
+		    eval cid${multipart}=\"$cid\"
+		    eval isentity${multipart}=$isentity
+		    cdescrip=         # -Immi
+		    attachfilename=   # -Immi
+		    isentity=0
+		    ctype=
+		    datafile=
+		    encode=
+		    encodingprog=
+		    newid=`date | tr " :" "__"`
+		    cid="<${newid}_$idctr@${hname}>"
+		    idctr=`expr $idctr + 1`
+		    multipart=`expr $multipart + 1`
+		    ;;
+		*)
+		    anotherpart=0;;
+	    esac
+	done
+
 else
-    if ($outputfile == "") then
-      if (! $?to || ! $?subject || ! $?ctype || ! $?datafile) then
-        echo metasend: in batch mode, if output is not directed to a file,-t, -s, -f, and -m are all required
-        exit -1
-      endif
-    else
-      if (! $?datafile) then
-        echo metasend:  in batch mode, -f is required.
-      endif
-      if ($isentity) then
-        if (! $?ctype) then
-          set ctype=bogus
-          # will not be used anyway really
-        endif
-      endif
-      if (! $?ctype  ) then
-        echo metasend: in batch mode, with output directed to a file, -E or -m is required
-        exit -1
-      endif
-    endif    
-    if (! -e  $datafile) then
-        echo metasend:  The file $datafile does not exist
-        exit -1
-    endif
-#    if (! $?cc) set cc=""
-#     if ($ctype != $ctyperaw)  echo Double  quotes not allowed, using $ctype
-    if (! $?encode) then
-        if ("$ctype" =~ text*) then
-	set encodingprog = "mimencode -q"
-	set encode = "quoted-printable"
-        else
-            set encodingprog = "mimencode -b"
-            set encode = base64
-        endif
-    else if ($encode == "base64") then
-        set encodingprog = "mimencode -b"
-    else if ($encode == "x-uue") then
-        set encodingprog = "uuencode mail-body"
-    else if ($encode == "7bit") then
-        set encodingprog = cat
-    else
-        set encodingprog = "mimencode -q"
-        set encode = "quoted-printable"
-    endif
-endif
-
-if (! $?encode) then
-        if ("$ctype" =~ text*) then
-	set encode = "quoted-printable"
-	set encodingprog = "mimencode -q"
-        else
-            set encode = base64
-            set encodingprog = "mimencode -b"
-        endif
-endif
-set ctype${multipart} = "$ctype"
-set datafile${multipart} = $datafile
-set encode${multipart} = $encode
-set cdescrip${multipart} = "$cdescrip"
-set cid${multipart} = "$cid"
-set isentity${multipart} = $isentity
-set encodingprog${multipart} = "$encodingprog"
+	if test -z "${outputfile:-}"
+	then
+	    if test -z "${to:-}" \
+		-o -z "${subject:-}" \
+		-o -z "${ctype:-}" \
+		-o -z "${datafile:-}"
+	    then
+		echo "metasend: in batch mode, if output is not directed to a file,  -t, -s, -f, and -m are all required"
+		exit 1
+	    fi
+	else
+	    if test -z "${datafile:-}"
+	    then
+		echo "metasend: in batch mode, -f is required."
+		exit 1
+	    fi
+	    if test $isentity -ne 0
+	    then
+	        if test -z "${ctype:-}"
+	        then
+			ctype=bogus
+			#  will not be used anyway
+		fi
+	    fi
+	    if test -z "${ctype:-}"
+	    then
+		echo "metasend: in batch mode, with output directed to a file, -E or -m is required."
+		exit 1
+	    fi
+	fi
+
+
+	if test ! -r "$datafile"
+	then
+		echo "metasend: The file $datafile does not exist"
+		exit 1
+	fi
+
+#	if test -z "${cc:-}"
+#	then
+#		cc=''
+#	fi
+
+	if test -z "${encode:-}"
+	then
+		case "$ctype" in
+			text*) encodingprog="mimencode -q"
+			       encode=quoted-printable ;;
+			*) encodingprog="mimencode -b"
+			   encode=base64 ;;
+		esac
+	else
+		case "$encode" in
+			base64) encodingprog="mimencode -b" ;;
+			x-uue)  encodingprog="uuencode $datafile" ;;
+			7bit)   encodingprog=cat ;;
+			8bit)   encodingprog=cat ;;
+			*) encodingprog="mimencode -q"
+			   encode=quoted-printable ;;
+		esac
+	fi
+fi
+
+if test -z "${encode:-}"
+then
+	case "$ctype" in
+		text*) encodingprog="mimencode -q"
+		       encode=quoted-printable ;;
+		*) encodingprog="mimencode -b"
+		   encode=base64 ;;
+	esac
+fi
+
+eval ctype${multipart}=\"$ctype\"
+eval datafile${multipart}=$datafile
+eval encode${multipart}=$encode
+eval cdescrip${multipart}=\"$cdescrip\"
+eval attachfilename${multipart}=\"$attachfilename\"   # -Immi
+eval cid${multipart}=\"$cid\"
+eval isentity${multipart}=$isentity
+eval encodingprog${multipart}=\"\$encodingprog\"
 
-set fname = ${METAMAIL_TMPDIR}/metasend.$$
+fname=`tempfile -p metamail -m 600`
 echo "MIME-Version: 1.0" > $fname
-if ($?to) then
-    echo "To: " "$to" >> $fname
-endif
-if ($?subject) then
-    echo "Subject: " "$subject" >> $fname
-endif
-if ($?cc) then
-    echo "CC: " "$cc" >> $fname
-endif
-if ($?from) then
-    echo "From: " "$from" >> $fname
-endif
-if ($multipart > 1) then
-    set  boundary = ${hname}.$$.`date | tr "  " .`
-    set newid=`date | tr " :" "__"`
-    if ($?multicid) then
-        echo "Content-ID: $multicid"   >> $fname
-    else
-        echo "Content-ID: <${newid}_$idctr@${hname}>"   >> $fname
-        @ idctr++
-    endif
-    echo "Content-type: multipart/$multipartsubtype;" >> $fname
-    echo "	boundary="\"$boundary\" >> $fname
-    echo "" >> $fname
-    if ($?preamblefile) then
-        cat $preamblefile >> $fname
-    else
-        echo "This is  a multimedia message in MIME  format.  If you are reading this" >> $fname
-        echo "prefix, your mail reader does  not understand MIME.  You may wish" >> $fname
-        echo "to look into upgrading to a newer version of  your mail reader." >> $fname
-    endif
-    set i=1
-    set junkfile=${METAMAIL_TMPDIR}/mmjunk.$$
-    while  ($multipart >= $i)
+
+if test ! -z "${to:-}"
+then echo "To: $to" >> $fname
+fi
+if test ! -z "${subject:-}"
+then echo "Subject: $subject" >> $fname
+fi
+if test ! -z "${cc:-}"
+then echo "CC: $cc" >> $fname
+fi
+if test ! -z "${from:-}"
+then echo "From: $from" >> $fname
+fi
+
+if test $multipart -gt 1
+then
+	boundary=${hname}.$$.`date | tr "  " .`
+	newid=`date | tr " :" "__"`
+	if test ! -z "${multicid:-}"
+	then
+		echo "Content-ID: $multicid" >> $fname
+	else
+		echo "Content-ID: ${newid}_$idctr@${hname}" >> $fname
+		idctr=`expr $idctr + 1`
+	fi
+	echo "Content-type: multipart/$multipartsubtype;" >> $fname
+	echo "	boundary="\"$boundary\" >> $fname
+	echo "" >> $fname
+	if test ! -z "${preamblefile:-}"
+	then
+		cat $preamblefile >> $fname
+	else
+		echo "This is  a multimedia message in MIME  format.  If you are reading this" >> $fname
+		echo "prefix, your mail reader does  not understand MIME.  You may wish" >> $fname
+		echo "to look into upgrading to a newer version of  your mail reader." >> $fname
+	fi
+
+	i=1
+	while test $multipart -ge $i
+	do
+		echo "" >> $fname
+		echo --$boundary >> $fname
+		eval isentity=\$isentity$i
+
+		if test $isentity -eq 0
+		then
+			eval echo "Content-ID: \$cid$i" >> $fname
+			eval echo "Content-type: \$ctype$i" >> $fname
+#begin immi
+			eval cdescrip=\$cdescrip$i
+			if test ! -z "$cdescrip"
+			then
+				echo "Content-Description: $cdescrip" >> $fname
+			fi
+			eval attachfilename=\$attachfilename$i
+			if test ! -z "$attachfilename"
+			then
+				echo "Content-Disposition: attachment; filename=\"$attachfilename\"" >> $fname
+			fi
+#end immi
+			eval echo "Content-Transfer-Encoding: \$encode$i" >> $fname
+			echo "" >> $fname
+		fi
+		eval \$encodingprog$i \< \"\$datafile$i\" \>\> $fname
+		i=`expr $i + 1`
+	done
+	echo "" >> $fname
+	echo --${boundary}-- >> $fname
 	echo "" >> $fname
-	echo --$boundary >> $fname
-	echo set isentity=\$isentity$i > $junkfile
-	source $junkfile
-	if (! $isentity) then
-	    echo -n "Content-ID: "   >> $fname
-	    echo echo \$cid$i \>\>  $fname > $junkfile
-	    source $junkfile 
-	    echo -n "Content-type: ">>$fname
-	    echo echo \$ctype$i \>\>  $fname > $junkfile
-	    source $junkfile 
-	    echo -n "Content-Description: ">>$fname
-	    echo echo \"\$cdescrip$i \" \>\>  $fname > $junkfile
-	    source $junkfile 
-	    echo -n "Content-Transfer-Encoding: " >>$fname
-	    echo echo \$encode$i \>\> $fname > $junkfile
-	    source $junkfile 
-	    echo ""  >> $fname
-	endif
-	echo \$encodingprog$i \< \$datafile$i \>\> $fname > $junkfile
-	source $junkfile 
-	@ i++
-    end
-    rm $junkfile
-    echo "" >> $fname
-    echo --${boundary}-- >> $fname
-    echo "" >> $fname
-else 
-    if (! $isentity) then
-        echo "Content-ID: $cid"   >> $fname
-        echo "Content-type: " $ctype >> $fname
-        echo "Content-Description: " $cdescrip >> $fname
-        echo "Content-Transfer-Encoding: " $encode >> $fname
-    endif
-    echo  "" >> $fname
-    $encodingprog < $datafile >> $fname
-    # Ensure last line has trailing carriage return
-    echo "" >> $fname
-endif
-if ($outputfile == "") then
-    if ($batchmode == 0) echo -n "Delivering mail, please wait...  "
-    splitmail -s $splitsize -d $fname
-    if (! $status) then
-        if ($batchmode == 0) echo "Mail delivery apparently succeeded."
-        rm $fname
-    else if ($MustDelete == 1) then
-        echo Mail delivery failed
-        rm $fname
-        exit -1
-    else
-        echo Mail delivery failed, draft mail is in $fname
-        exit -1
-    endif
 else
-    mv $fname $outputfile
-    if ($status) exit -1
-endif
+	if test $isentity -eq 0
+	then
+		echo "Content-ID: $cid" >> $fname
+		echo "Content-type: $ctype" >> $fname
+#begin immi
+		if test ! -z "$cdescrip"
+		then
+			echo "Content-Description: $cdescrip" >> $fname
+		fi
+		if test ! -z "$attachfilename"
+		then
+			echo "Content-Disposition: attachment; filename=\"$attachfilename\"" >> $fname
+		fi
+#end immi
+		echo "Content-Transfer-Encoding: $encode" >> $fname
+	fi
+	echo "" >> $fname
+	$encodingprog < "$datafile" >> $fname
+	# Ensure last line has trailing carriage return
+	echo "" >> $fname
+fi
+
+if test -z "${outputfile:-}"
+then
+	if test $batchmode = 0
+	then
+		echo -n "Delivering mail, please wait...  "
+	fi
+	splitmail -s "$splitsize" -d $fname
+
+	if test $? -eq 0
+	then
+		if test $batchmode = 0
+		then
+			echo "Mail delivery apparently succeeded."
+		fi
+		rm $fname
+	elif test "$MustDelete" -eq 1
+	then
+		echo Mail delivery failed
+		rm $fname
+		exit -1
+	else
+		echo "Mail delivery failed, draft mail is in $fname"
+		exit -1
+	fi
+else
+	mv $fname "$outputfile"
+	if test $? -ne 0
+	then
+		exit -1
+	fi
+fi
 exit 0
 
+
--- metamail-2.7.orig/bin/showpartial
+++ metamail-2.7/bin/showpartial
@@ -1,92 +1,156 @@
-#!/bin/csh -fb
-# (The "-fb" might need to be changed to "-f" on some systems)
-#
-
-if (! $?METAMAIL_TMPDIR) then
-    set METAMAIL_TMPDIR=/tmp
-endif
-
-set TREEROOT=${METAMAIL_TMPDIR}/m-prts-`whoami`
-if ($#argv < 3 || $#argv > 4) then
-    echo "Usage:  showpartial file id partnum totalnum"
-    exit -1
-endif
-set file=$1
+#!/bin/sh -e
+# Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
+# 
+# Permission to use, copy, modify, and distribute this material 
+# for any purpose and without fee is hereby granted, provided 
+# that the above copyright notice and this permission notice 
+# appear in all copies, and that the name of Bellcore not be 
+# used in advertising or publicity pertaining to this 
+# material without the specific, prior written permission 
+# of an authorized representative of Bellcore.  BELLCORE 
+# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
+# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
+# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+
+# Conversion from C shell to Bourne shell by Z-Code Software Corp.
+# Conversion Copyright (c) 1992 Z-Code Software Corp.
+# Permission to use, copy, modify, and distribute this material
+# for any purpose and without fee is hereby granted, provided
+# that the above copyright notice and this permission notice
+# appear in all copies, and that the name of Z-Code Software not
+# be used in advertising or publicity pertaining to this
+# material without the specific, prior written permission
+# of an authorized representative of Z-Code.  Z-CODE SOFTWARE
+# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
+# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
+# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+
+if [ -z "$METAMAIL_TMPDIR" ]
+then
+	METAMAIL_TMPDIR=/tmp
+fi
+
+
+
+if test -z "$3" -o ! -z "$5"
+then
+	echo "Usage: showpartial file id partnum totalnum"
+	exit 1
+fi
+
+file=$1
+
 # This next line is because message-id can contain weird chars
-set id=`echo $2 | tr -d  \!\$\&\*\(\)\|\'\"\;\/\<\>\\` 
-@ partnum = $3
-if ($#argv == 3 || $4 == "") then
-    set totalnum=-1
+id=$(echo "$2" | tr -d \!\$\&\*\(\)\|\'\"\;\/\<\>\\\\ )
+
+partnum=$3
+
+if test -z "$4"
+then
+	totalnum=-1
+else
+	totalnum=$4
+fi
+
+if [ -n "$HOME" ] ; then
+# If we have a home directory, create a temporary dir and
+# store the name there unless the file already exists
+# and the directory it points to is valid directory
+	[ -e "$HOME/.metamail_treeroot" ] && TREEROOT=`cat $HOME/.metamail_treeroot`
+	[ -e "$TREEROOT" ] && [ ! -d "$TREEROOT" ] && rm -f "$TREEROOT" 
+	if [ ! -e "$HOME/.metamail_treeroot" ] || [ ! -e "$TREEROOT" ]; then
+		TREEROOT=`mktemp -d -t msg-parts.XXXXXX` || { echo "$0: Cannot create temporary dir!" >&2 ; exit 1; }
+		echo $TREEROOT >$HOME/.metamail_treeroot
+	fi
 else
-    @ totalnum = $4
-endif
+	TREEROOT=$METAMAIL_TMPDIR/msg-parts-`whoami`
+	# Sanity check: is this a directory?
+	[ -e "$TREEROOT" ] && [ ! -d "$TREEROOT" ] && rm -f "$TREEROOT" 
+	# Sanity check, does it belong to us?
+	if [ -d "$TREEROOT" ] ; then
+		treeuid=`stat -c %u "$TREEROOT"`
+		if [ "$treeuid" -ne "`id -u`" ]; then
+			echo "$0: Tried to use $TREEROOT but it does not belong to us! Aborting." >&2
+			exit 1
+		fi
+	else
+		mkdir -p "$TREEROOT" || { echo "$0: Cannot create dir $TREEROOT!" >&2 ; exit 1; }
+	fi
+
+fi
+if test ! -d "${TREEROOT}/$id"
+then
+	mkdir "${TREEROOT}/$id"
+	if test $? -ne 0
+	then
+	        echo mkdir "${TREEROOT}/$id" failed
+		exit 1
+	fi
+fi
 
-if (! -d  $TREEROOT)  then
-    mkdir $TREEROOT
-    if ($status) then 
-        echo mkdir $TREEROOT failed
-        exit -1
-    endif
-endif
-if (! -d ${TREEROOT}/$id) then 
-    mkdir ${TREEROOT}/$id
-    if ($status) then 
-        echo mkdir ${TREEROOT}/$id failed
-        exit -1
-    endif
-endif
-cp $file ${TREEROOT}/$id/$partnum
-if ($status) then 
-    echo cp $file ${TREEROOT}/$id/$partnum failed
-    exit -1
-endif
-if ($totalnum == -1) then
-    if (-e ${TREEROOT}/$id/CT) then
-	set totalnum=`cat ${TREEROOT}/$id/CT`
-    else
-    	set totalnum=-1  #GROSS HACK
-    endif
+cp $file "${TREEROOT}/$id/$partnum"
+if test $? -ne 0
+then
+	echo cp $file "${TREEROOT}/$id/$partnum" failed
+	exit 1
+fi
+
+if test $totalnum -eq -1
+then
+	if test -r "${TREEROOT}/$id/CT"
+	then
+		totalnum=`cat "${TREEROOT}/$id/CT"`
+	else
+    		totalnum=-1
+	fi
 else
-    echo $totalnum >! ${TREEROOT}/$id/CT
-endif
+	echo $totalnum > "${TREEROOT}/$id/CT"
+fi
+
 # Slightly bogus here -- the shell messes up the newlines in the headers
-# If you put $MM_HEADERS in quotes, it doesn't help.
 # if ($partnum == 1) then
-#     echo $MM_HEADERS > ${TREEROOT}/$id/HDRS
+#     echo $MM_HEADERS > "${TREEROOT}/$id/HDRS"
 # endif
-set found=0
-set ix=1
-set list=""
-set limit=$totalnum
-if ($limit == -1) set limit=25
-while ($ix <= $limit)
-    if (-e ${TREEROOT}/$id/$ix) then
-	set list="$list $ix"
-	@ found ++
-    endif
-    @ ix ++
-end
-if ($found == $totalnum) then
-    cd ${TREEROOT}/$id
-    cat $list > ${TREEROOT}/$id/FULL
-#    cat ${TREEROOT}/$id/HDRS $list > ${TREEROOT}/$id/FULL
-    rm $list
-    echo All parts of this ${totalnum}-part message have now been read.
-    metamail -d  ${TREEROOT}/$id/FULL
-    echo WARNING:  To save space, the full file is now being deleted.  
-    echo You will have to read all $totalnum parts again to see the full message again.
-    rm ${TREEROOT}/$id/FULL
-    rm ${TREEROOT}/$id/CT
-#    rm ${TREEROOT}/$id/HDRS
-    cd
-    rmdir ${TREEROOT}/$id
-    rmdir ${TREEROOT} >& /dev/null
+found=0
+ix=1
+list=
+limit=$totalnum
+if test "$limit" -eq -1
+then
+	limit=25
+fi
+
+while test "$ix" -le "$limit"
+do
+	if test -f "${TREEROOT}/$id/$ix"
+	then
+		list="$list $ix"
+		found=$(($found + 1))
+	fi
+	ix=`expr $ix + 1`
+done
+
+if test $found = "$totalnum"
+then
+	cd "${TREEROOT}/$id"
+	cat $list > "${TREEROOT}/$id/FULL"
+	rm $list
+	echo All parts of this "${totalnum}"-part message have now been read.
+	metamail -d < "${TREEROOT}/$id/FULL"
+	echo WARNING:  To save space, the full file is now being deleted.  
+	echo You will have to read all "$totalnum" parts again to see the full message again.
+	rm "${TREEROOT}/$id/FULL"
+	rm "${TREEROOT}/$id/CT"
+	cd ${METAMAIL_TMPDIR}
+	rmdir "${TREEROOT}/$id"
+	rmdir ${TREEROOT} > /dev/null 2>&1
+	[ -e "$HOME/.metamail_treeroot" ] && > "$HOME/.metamail_treeroot" 
 else
-    if (${totalnum} == -1) then
-        echo So far you have only read $found of the several parts of this message.
-    else
-        echo So far you have only read $found of the $totalnum parts of this message.
-    endif
-    echo When you have read them all, then you will see the message in full.
-endif
-    
+	if test "$totalnum" -eq -1
+	then
+		echo So far you have only read $found of the several parts of this message.
+	else
+		echo So far you have only read $found of the "$totalnum" parts of this message.
+	fi
+	echo When you have read them all, then you will see the message in full.
+fi
--- metamail-2.7.orig/bin/audiosend
+++ metamail-2.7/bin/audiosend
@@ -1,6 +1,4 @@
-#!/bin/csh -fb
-# (The "-fb" might need to be changed to "-f" on some systems)
-#
+#!/bin/sh -e
 # Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
 # 
 # Permission to use, copy, modify, and distribute this material 
@@ -13,97 +11,114 @@
 # MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
 # OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
 # WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
-#
 
-if (! $?METAMAIL_TMPDIR) then
-    set METAMAIL_TMPDIR=/tmp
-endif
+# Conversion from C shell to Bourne shell by Z-Code Software Corp.
+# Conversion Copyright (c) 1992 Z-Code Software Corp.
+# Permission to use, copy, modify, and distribute this material
+# for any purpose and without fee is hereby granted, provided
+# that the above copyright notice and this permission notice
+# appear in all copies, and that the name of Z-Code Software not
+# be used in advertising or publicity pertaining to this
+# material without the specific, prior written permission
+# of an authorized representative of Z-Code.  Z-CODE SOFTWARE
+# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
+# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
+# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+
+# Brought into line with metamail 2.7 beta release Csh version
+#    Dave Shield	February 1994
 
 # This is to make metamail/showaudio do playback on the speaker, not the phone.
-setenv AUDIOSPEAKERFORCE 1 
+AUDIOSPEAKERFORCE=1 ; export AUDIOSPEAKERFORCE
+
+if test -d /usr/sony
+then
+	dev=/dev/sb0
+else
+	dev=/dev/audio
+fi
 
-if (-d /usr/sony) then
-    set dev=/dev/sb0
+if test -f /usr/sbin/sendmail
+then
+    MAILCOMMAND=/usr/sbin/sendmail
 else
-    set dev=/dev/audio
-endif
+    MAILCOMMAND=mail
+fi
 
-if ( $#argv == 1 ) then
-    set to = $1
+if test ! -z "${1:-}"
+then
+    to=$1
 else
     echo -n "To: "
-    set to = $<
-endif
+    read to
+fi
 echo -n "Subject: "
-set subject = $<
+read subject
 echo -n "CC: "
-set cc = $<
+read cc
 
-record:
-echo -n "Press RETURN when you are ready to start recording: "
-set foo = $<
-
-set fname = ${METAMAIL_TMPDIR}/audio-out.$$
-set fnameraw = ${METAMAIL_TMPDIR}/audio-raw.$$
-
-echo "To: " "$to" > $fname
-echo "Subject: " "$subject" >> $fname
-echo "CC: " "$cc" >> $fname
-echo "MIME-Version: 1.0" >> $fname
-echo "Content-Type: audio/basic" >> $fname
-echo "Content-Transfer-Encoding: base64" >> $fname
-echo  "" >> $fname
-# THIS IS UNBELIEVABLY GRUBBY
-onintr cleanup
-if (! $?RECORD_AUDIO) then
-    (/bin/cat < $dev > $fnameraw) &
-else
-    ($RECORD_AUDIO > $fnameraw) &
-endif
-jobs -l > ${METAMAIL_TMPDIR}/AUDCAT.$$
-set foo=`/bin/cat ${METAMAIL_TMPDIR}/AUDCAT.$$`
-/bin/rm ${METAMAIL_TMPDIR}/AUDCAT.$$
-set PID=$foo[2]
-echo -n "press RETURN when you are done recording: "
-set foo=$<
-echo One moment please...
-/bin/sleep 1
-echo -n Killing recording job...
-/bin/kill -9 $PID >& /dev/null
-mimencode -b < $fnameraw >> $fname
-/bin/rm $fnameraw
-echo "" >> $fname
-
-whatnext:
-echo ""
-echo "What do you want to do?"
-echo ""
-echo "1 -- Send mail"
-echo "2 -- Listen to recorded message"
-echo "3 -- Replace with a new recording"
-echo "4 -- Quit"
-set which = $<
-    switch ("$which")
-        case 1:
-          echo -n "Sending mail, please wait...  "
-          /usr/lib/sendmail $to  $cc < $fname
-          if (! $status) then
-            echo "Done."
-            rm $fname
-            exit
-          else
-            echo Mail delivery failed, draft mail is in $fname
-          endif
-          breaksw
-        case 2:
-          metamail -d $fname
-          breaksw
-        case 3:
-          goto record
-        case 4:
-          exit
-    endsw
-goto whatnext
-exit 0
-cleanup:
-kill -9 $PID >& /dev/null
+record=1
+
+while true
+do
+	if test $record -eq 1
+	then
+		echo -n "Press RETURN when you are ready to start recording: "
+		read foo
+
+		fname=`tempfile -p metamail -m 600`
+		fnameraw=`tempfile -p metamail -m 600`
+
+		echo "To: $to" > $fname
+		echo "Subject: $subject" >> $fname
+		echo "CC: $cc" >> $fname
+		echo "MIME-Version: 1.0" >> $fname
+		echo "Content-Type: audio/basic" >> $fname
+		echo "Content-Transfer-Encoding: base64" >> $fname
+		echo "" >> $fname
+
+		trap "kill -9 $! > /dev/null 2>&1" HUP INT TERM
+
+		if test -z "RECORD_AUDIO"
+		then
+			(cat < $dev > $fnameraw) &
+		else
+			($RECORD_AUDIO > $fnameraw) &
+		fi
+		echo -n "press RETURN when you are done recording: "
+		read foo
+		echo One moment please...
+		sleep 1
+		echo -n Killing recording job...
+		kill -9 $! > /dev/null 2>&1
+		mimencode -b < $fnameraw >> $fname
+		rm $fnameraw
+		echo "" >> $fname
+	fi
+	record=0
+
+	echo ""
+	echo "What do you want to do?"
+	echo ""
+	echo "1 -- Send mail"
+	echo "2 -- Listen to recorded message"
+	echo "3 -- Replace with a new recording"
+	echo "4 -- Quit"
+	read which
+	case $which in
+		1) echo -n "Sending mail, please wait...  "
+		  $MAILCOMMAND $to $cc < $fname
+
+		  if test $? -eq 0
+		  then
+			echo Done.
+			rm $fname
+			exit 0
+		  else
+			echo Mail delivery failed, draft is in $fname
+		  fi ;;
+		2) metamail -d $fname ;;
+		3) record=1 ;;
+		4) exit 0 ;;
+	esac
+done
--- metamail-2.7.orig/bin/patch-metamail
+++ metamail-2.7/bin/patch-metamail
@@ -1,20 +1,58 @@
-#!/bin/csh -fb
-# (The "-fb" might need to be changed to "-f" on some systems)
-#
-set HOSTNAME=thumper.bellcore.com
-set DIRNAME=pub/nsb
-set PREFIX="mm.patch."
-
-if ($#argv < 2 || $#argv > 5) then
-	echo Usage:  patch-metamail source-tree-root patch-number [hostname [dirname [prefix]]]
-	exit -1
-endif
-
-set TREEROOT=$1
-set PATCHNUMBER=$2
-if ($#argv > 2) set HOSTNAME=$3
-if ($#argv > 3) set DIRNAME=$4
-if ($#argv > 4) set PREFIX=$5
+#!/bin/sh -e
+# Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
+# 
+# Permission to use, copy, modify, and distribute this material 
+# for any purpose and without fee is hereby granted, provided 
+# that the above copyright notice and this permission notice 
+# appear in all copies, and that the name of Bellcore not be 
+# used in advertising or publicity pertaining to this 
+# material without the specific, prior written permission 
+# of an authorized representative of Bellcore.  BELLCORE 
+# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
+# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
+# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+
+# Conversion from C shell to Bourne shell
+# by Bob Glickstein, Z-Code Software Corp.
+# Conversion Copyright (c) 1992 Z-Code Software Corp. (Z-Code)
+# 
+# Permission to use, copy, modify, and distribute this material for
+# any purpose and without fee is hereby granted, provided that the
+# above copyright notice and this permission notice appear in all
+# copies, and that the name of Z-Code not be used in advertising or
+# publicity pertaining to this material without the specific, prior
+# written permission of an authorized representative of Z-Code.
+# Z-CODE MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY OF
+# THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", WITHOUT ANY
+# EXPRESS OR IMPLIED WARRANTIES.
+
+HOSTNAME=thumper.bellcore.com
+DIRNAME=pub/nsb
+PREFIX=mm.patch.
+
+if test -z "$2" -o ! -z "$6"
+then
+	echo "Usage: patch-metamail source-tree-root patch-number [hostname [dirname [prefix]]]"
+	exit 1
+fi
+
+TREEROOT=$1
+PATCHNUMBER=$2
+
+if test ! -z "$3"
+then
+	HOSTNAME=$3
+fi
+
+if test ! -z "$4"
+then
+	DIRNAME=$4
+fi
+
+if test ! -z "$5"
+then
+	PREFIX=$5
+fi
 	
 echo WARNING:  This program, if allowed to do so, will attempt to 
 echo install a PATCH file for your metamail sources which are rooted 
@@ -22,15 +60,16 @@
 echo ""
 echo It will use a patch file that it retrieves via anonymous ftp
 echo from the host $HOSTNAME, in the directory $DIRNAME, 
-echo with filenames starting with ${PREFIX}.
+echo with filenames starting with $PREFIX.
 echo ""
-echo -n "Do you want to install the patch in directory $TREEROOT [y/n] ? "
-set ans=$<
-if ($ans == "y" || $ans == "Y") then
-    cd $TREEROOT
-    set ident=`whoami`@`hostname`
-    echo Using anonymous ftp with password $ident
-    ftp -n <<!
+echo -n "Do you want to install the patch in directory $TREEROOT (y/n)? [n] "
+read ans
+
+case "$ans" in
+	[Yy]*) cd $TREEROOT
+	       ident=`whoami`@`hostname`
+	       echo Using anonymous ftp with password $ident
+	       ftp -n <<!
 open $HOSTNAME
 user anonymous $ident
 cd $DIRNAME
@@ -38,8 +77,6 @@
 get ${PREFIX}${PATCHNUMBER}
 quit
 !
-    patch -p < ${PREFIX}${PATCHNUMBER}
-else
-	echo Patch not installed
-endif
-
+	       patch -p < ${PREFIX}${PATCHNUMBER} ;;
+	*) echo Patch not installed
+esac
--- metamail-2.7.orig/bin/showexternal
+++ metamail-2.7/bin/showexternal
@@ -1,6 +1,4 @@
-#!/bin/csh -fb
-# (The "-fb" might need to be changed to "-f" on some systems)
-#
+#!/bin/sh -e
 # Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
 # 
 # Permission to use, copy, modify, and distribute this material 
@@ -13,142 +11,174 @@
 # MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
 # OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
 # WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
-# 
 
-onintr cleanup
-if (! $?METAMAIL_TMPDIR) then
-    set METAMAIL_TMPDIR=/tmp
-endif
-if (! $?FTP) then
-    set FTP=ftp
-endif
-
-if ($#argv <3) then
-    echo "Usage: showexternal body-file access-type name [site [directory [mode [server]]]]"
-    exit -1
-endif
-set bodyfile=$1
-set atype=`echo $2 | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
-set name=$3
-if ($#argv > 3) then
-    set site=$4
-else 
-    set site=""
-endif
-if ($#argv > 4) then
-    set dir=$5
-else
-    set dir=""
-endif
-if ($#argv > 5) then
-    set mode=$6
-else
-    set mode=""
-endif
-if ($#argv > 6) then
-    set server=$7
+# Conversion from C shell to Bourne shell by Z-Code Software Corp.
+# Conversion Copyright (c) 1992 Z-Code Software Corp.
+# Permission to use, copy, modify, and distribute this material
+# for any purpose and without fee is hereby granted, provided
+# that the above copyright notice and this permission notice
+# appear in all copies, and that the name of Z-Code Software not
+# be used in advertising or publicity pertaining to this
+# material without the specific, prior written permission
+# of an authorized representative of Z-Code.  Z-CODE SOFTWARE
+# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
+# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
+# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+
+# Brought into line with metamail 2.7 beta release Csh version
+#    Dave Shield	February 1994
+
+if test -f /usr/sbin/sendmail
+then
+    MAILCOMMAND=/usr/sbin/sendmail
 else
-    set server=""
-endif
+    MAILCOMMAND=/bin/mail
+fi
 
-if ("$server" == "" && $atype == "mail-server") then
-# Backward compatibility with some broken stuff
-    set server=${name}@${site}
-    echo WARNING -- old style mailserver syntax, using server $server
-endif
-
-set ctype="`grep -i content-type: $bodyfile | sed -e 's/............: //'`"
-if ("$ctype" == "") set ctype="text/plain"
-set cenc=`grep -i content-transfer-encoding: $bodyfile | sed -e 's/.........................: //'`
-set username=""
-set pass=""
-set TMPDIR=${METAMAIL_TMPDIR}/XXXternal.$$
+if test "$#" -lt 3
+then
+	echo "Usage: showexternal body-file access-type name [site [directory [mode]]]"
+	exit 1
+fi
+
+if [ -z "$METAMAIL_TMPDIR" ]
+then
+	METAMAIL_TMPDIR=/tmp
+fi
+
+# Check argument integrity. Don't trust mail headers
+if echo "$1$2$3$4$5$6$7" | grep -q '[[:space:]]'
+then
+	echo "Illegal white space in arguments -- possibly a mail bomb?!"
+	echo "Command was:"
+	echo \'$0\' \'$1\' \'$2\' \'$3\' \'$4\' \'$5\' \'$6\' \'$7\'
+	exit 2
+fi
+
+bodyfile=$1
+atype=$(echo "$2" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)
+name=$3
+
+site=$4
+
+dir=$5
+
+mode=$6
+
+server=$7
+
+if test -z "$server" -a $atype = "mail-server"
+then
+	server=${name}@${site}
+	echo WARNING -- old style mailserver syntax, using server "$server"
+fi
+
+ctype=$(grep -i content-type: "$bodyfile" | sed -e 's/............: //')
+if test -z "$ctype"
+then ctype="text/plain"
+fi
+cenc=$(grep -i content-transfer-encoding: "$bodyfile" | sed -e 's/.........................: //')
+username=
+pass=
+TMPDIR=$METAMAIL_TMPDIR/XXXternal.$$
+trap 'cd $METAMAIL_TMPDIR ; rmdir "$TMPDIR" >/dev/null 2>&1' 1 2 3 15
 mkdir $TMPDIR
-pushd $TMPDIR
-set NEWNAME="mm.ext.$$"
-set NEEDSCONFIRMATION=1
-switch ("$atype")
-    case anon-ftp:
-	echo "This mail message contains a POINTER (reference) to data that is "
-	echo not included in the message itself.  Rather, the data can be retrieved 
-	echo automatically using  anonymous FTP to a site on the network.
-	breaksw
-    case ftp:
-	echo "This mail message contains a POINTER (reference) to data that is "
-	echo not included in the message itself.  Rather, the data can be retrieved 
-	echo automatically using  the FTP protocol to a site on the network.
-	breaksw
-    case mail-server:  
-	cat > ${METAMAIL_TMPDIR}/ext.junk.$$ <<!
-This mail message contains a POINTER (reference) to data that is 
-not included in the message itself.  Rather, the data can be retrieved 
-by sending a special mail message to a mail server on the network.
-However, doing this automatically is slightly dangerous, because  someone
-might be using this mechanism to cause YOU to send obnoxious mail.
-For that reason, the mail message that WOULD be sent is being shown to you
-first for your approval.
+PUSHED_DIR=`pwd`
+cd $TMPDIR
+NEWNAME="mm.ext.$$"
+NEEDSCONFIRMATION=1
+
+case $atype in
+	anon-ftp)
+		echo "This mail message contains a POINTER (reference) to data that is "
+		echo not included in the message itself.  Rather, the data can be retrieved 
+		echo automatically using anonymous FTP to a site on the network. ;;
+		
+	ftp)
+		echo "This mail message contains a POINTER (reference) to data that is "
+		echo not included in the message itself.  Rather, the data can be retrieved 
+		echo automatically using the FTP protocol to a site on the network. ;;
+
+	mail-server)
+		TMPF=$(mktemp /tmp/ext.junk.XXXXXX)
+		cat > $TMPF <<!
+This mail message contains a POINTER (reference) to data that is not
+included in the message itself.  Rather, the data can be retrieved by
+sending a special mail message to a mail server on the network.
+However, doing this automatically is slightly dangerous, because
+someone might be using this mechanism to cause YOU to send obnoxious
+mail.  For that reason, the mail message that WOULD be sent is being
+shown to you first for your approval.
 
 This is the message that will be sent if you choose to go ahead and
-retreive the external data:
+retrieve the external data:
 
 Subject: Automated Mail Server Request
-To: ${server}
+To: $server
 
 !
-	sed -e 1,/^\$/d < $bodyfile >> ${METAMAIL_TMPDIR}/ext.junk.$$
-	more ${METAMAIL_TMPDIR}/ext.junk.$$
-	rm ${METAMAIL_TMPDIR}/ext.junk.$$
-	breaksw
-    default:
-	# IGNORE ALL THE OTHERS -- AUTOMATIC FOR LOCAL-FILE, AFS.
-	set NEEDSCONFIRMATION=0
-endsw
+		sed -e 1,/^\$/d < "$bodyfile" >> $TMPF
+		sensible-pager $TMPF
+		rm $TMPF ;;
+
+	*)
+		NEEDSCONFIRMATION=0 ;;
+esac
 
-if ($NEEDSCONFIRMATION) then
+if test $NEEDSCONFIRMATION -ne 0
+then
 	echo ""
-	echo -n "Do you want to proceed with retrieving the external data [y] ? "
-	set ANS=$<
-	if ("$ANS" =~ n* ||  "$ANS" =~ N* ) then
-		cd ${METAMAIL_TMPDIR}
-		rm -rf $TMPDIR
-		exit 0
-	endif
-endif
-
-switch ("$atype")
-    case anon-ftp:
-	set username=anonymous
-	set pass=`whoami`@`hostname`
-	# DROP THROUGH
-    case ftp:
-	if ("$site" == "") then
-	    echo -n "Site for ftp access: "
-	    set site=$<
-	endif
-	if ("$username" == "") then
-	    echo -n "User name at site ${site}: "
-	    set username=$<
-	endif
-	if ("$pass" == "") then
-	    echo -n "Password for user $username at site ${site}: "
-	    stty -echo
-	    set pass=$<
-	    stty echo
-	    echo ""
-	endif
-	if ("$dir" == "") then
-	    set DIRCMD=""
-	else
-	    set DIRCMD="cd $dir"
-	endif
-	if ("$mode" == "") then
-	    set MODECMD=""
-	else
-	    set MODECMD="type $mode"
-	endif
-	echo OBTAINING MESSAGE BODY USING FTP
-	echo SITE: $site USER $username
-	$FTP -n <<!
+	echo -n "Do you want to proceed with retrieving the external data? [y] "
+	read ANS
+	case "$ANS" in
+		[Nn]*)	cd $METAMAIL_TMPDIR
+			rm -rf $TMPDIR;
+			exit 0 ;;
+	esac
+fi
+
+case "$atype" in
+	anon-ftp | ftp)
+		case "$atype" in
+		anon-ftp )
+			username=anonymous
+			pass=`whoami`@`hostname`
+			;;
+		esac
+
+		if test -z "$site"
+		then
+			echo -n "Site for ftp access: "
+			read site
+		fi
+		if test -z "$username"
+		then
+			echo -n "User name at site ${site}: "
+			read username
+		fi
+		if test -z "$pass"
+		then
+			echo -n "Password for user $username at site ${site}: "
+			stty -echo
+			read pass
+			stty echo
+			echo ""
+		fi
+		if test -z "$dir"
+		then
+			DIRCMD=""
+		else
+			DIRCMD="cd $dir"
+		fi
+		if test -z "$mode"
+		then
+			MODECMD=""
+		else
+			MODECMD="type $mode"
+		fi
+		echo OBTAINING MESSAGE BODY USING FTP
+		echo SITE: "$site" USER: "$username"
+		${FTP:-ftp} -n <<!
 open $site
 user $username $pass
 $DIRCMD
@@ -156,91 +186,92 @@
 get $name $NEWNAME
 quit
 !
-	if (! -e $NEWNAME) then
-	    echo FTP failed.
-	    cd ${METAMAIL_TMPDIR}
-	    rm -rf $TMPDIR
-	    exit -1
-	endif
-	breaksw
-    case afs:
-    case local-file:
-	if (! -e $name) then
-	    echo local file not found
-	    cd ${METAMAIL_TMPDIR}
-	    rm -rf $TMPDIR
-	    exit -1
-	endif
-    	set NEWNAME=$name
-	echo GETTING BODY FROM FILE NAMED: $NEWNAME
-	breaksw
-    case mail-server:  # A very special case
-	if ("$bodyfile" == "") then
-	    echo mail-server access-type requires a body file
-	    cd ${METAMAIL_TMPDIR}
-	    rm -rf $TMPDIR
-	    exit -1
-	endif
-	echo Subject: Automated Mail Server Request > $NEWNAME
-	echo To: ${server} >> $NEWNAME
-	echo "" >> $NEWNAME
-	sed -e 1,/^\$/d < $bodyfile >> $NEWNAME
-	echo "" >> $NEWNAME
-	/usr/lib/sendmail -t  < $NEWNAME
-	if ($status) then
-	    echo sendmail failed
-	    cd ${METAMAIL_TMPDIR}
-	    rm -rf $TMPDIR
-	    exit -1
-	endif
-	cd ${METAMAIL_TMPDIR}
-	rm -rf $TMPDIR
-	echo Your $ctype data has been requested from a mail server.
-	exit 0
-    default:
-	echo UNRECOGNIZED ACCESS-TYPE
-	cd ${METAMAIL_TMPDIR}
-	rm -rf $TMPDIR
-	exit -1
-endsw
-if ($cenc == base64) then
-	mimencode -u -b < $NEWNAME > OUT
-	mv OUT $NEWNAME
-else if ($cenc == quoted-printable) then
-	mimencode -u -q < $NEWNAME > OUT
-	mv OUT $NEWNAME
-endif
-
-popd
-if ($atype == "local-file") then
-    metamail -p  -b -c "$ctype" $NEWNAME
-else
-    metamail -p -b -c "$ctype" $TMPDIR/$NEWNAME
-endif
+		if test ! -r "$NEWNAME"
+		then
+			echo FTP failed.
+			cd $METAMAIL_TMPDIR
+			rm -rf $TMPDIR
+			exit 1
+		fi
+		;;
+
+	afs|local-file)
+		if test ! -r "$name"
+		then
+			echo local file not found
+			cd $METAMAIL_TMPDIR
+			rm -rf $TMPDIR
+			exit 1
+		fi
+		NEWNAME=$name
+		echo GETTING BODY FROM FILE NAMED: "$NEWNAME" ;;
+
+	mail-server)
+		if test -z "$bodyfile"
+		then
+			echo mail-server access-type requires a body file
+			cd $METAMAIL_TMPDIR
+			rm -rf $TMPDIR
+			exit 1
+		fi
+		echo Subject: Automated Mail Server Request > "$NEWNAME"
+		echo To: "$server" >> "$NEWNAME"
+		echo >> "$NEWNAME"
+		sed -e 1,/^\$/d < "$bodyfile" >> "$NEWNAME"
+		$MAILCOMMAND -t < "$NEWNAME"
+		if test $? -ne 0
+		then
+			echo sendmail failed
+			cd $METAMAIL_TMPDIR
+			rm -rf $TMPDIR
+			exit 1
+		fi
+		cd $METAMAIL_TMPDIR
+		rm -rf $TMPDIR
+		echo Your "$ctype" data has been requested from a mail server.
+		exit 0 ;;
+	*)
+		echo UNRECOGNIZED ACCESS-TYPE
+		cd $METAMAIL_TMPDIR
+		rm -rf $TMPDIR
+		exit 1 ;;
+esac
+
+if test "$cenc" = base64
+then
+	mimencode -u -b < "$NEWNAME" > OUT
+	mv OUT "$NEWNAME"
+elif test "$cenc" = quoted-printable
+then
+	mimencode -u -q < "$NEWNAME" > OUT
+	mv OUT "$NEWNAME"
+fi
+
+cd $PUSHED_DIR
+case "$atype" in
+    local-file ) metamail -b -p -c "$ctype" "$NEWNAME" ;;
+    * ) metamail -b -p -c "$ctype" "$TMPDIR/$NEWNAME" ;;
+esac
 
-if ($status) then
+if test $? -ne 0
+then
 	echo metamail failed
-	cd ${METAMAIL_TMPDIR}
+	cd $METAMAIL_TMPDIR
 	rm -rf $TMPDIR
-	exit -1
-endif
+	exit 1
+fi
 
-if ($NEWNAME != $name) then
+if test ! "$NEWNAME" = "$name"
+then
 	echo ""
-	echo The data just displayed is stored in the file $TMPDIR/$NEWNAME
+	echo The data just displayed is stored in the file "$TMPDIR/$NEWNAME"
 	echo "Do you want to delete it?"
-	rm -i $TMPDIR/$NEWNAME
-endif
+	rm -i "$TMPDIR/$NEWNAME"
+fi
 
-if (! -e ${TMPDIR}/${NEWNAME}) then
-    cd ${METAMAIL_TMPDIR}
-    rmdir $TMPDIR
-endif
-exit 0
-
-cleanup:
-cd ${METAMAIL_TMPDIR}
-if (-e $TMPDIR) then    
-    rmdir $TMPDIR
-endif
-exit -1
+if test ! -r "${TMPDIR}/${NEWNAME}"
+then
+	cd /
+	cd $METAMAIL_TMPDIR
+	rmdir $TMPDIR
+fi
--- metamail-2.7.orig/bin/audiocompose
+++ metamail-2.7/bin/audiocompose
@@ -1,6 +1,4 @@
-#!/bin/csh -fb
-# (The "-fb" might need to be changed to "-f" on some systems)
-#
+#!/bin/sh -e
 # Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
 # 
 # Permission to use, copy, modify, and distribute this material 
@@ -13,64 +11,71 @@
 # MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
 # OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
 # WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
-#
 
-if (! $?METAMAIL_TMPDIR) then
-    set METAMAIL_TMPDIR=/tmp
-endif
+# Conversion from C shell to Bourne shell by Z-Code Software Corp.
+# Conversion Copyright (c) 1992 Z-Code Software Corp.
+# Permission to use, copy, modify, and distribute this material
+# for any purpose and without fee is hereby granted, provided
+# that the above copyright notice and this permission notice
+# appear in all copies, and that the name of Z-Code Software not
+# be used in advertising or publicity pertaining to this
+# material without the specific, prior written permission
+# of an authorized representative of Z-Code.  Z-CODE SOFTWARE
+# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
+# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
+# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
 
 # This is to make metamail/showaudio do playback on the speaker, not the phone.
-setenv AUDIOSPEAKERFORCE 1 
+AUDIOSPEAKERFORCE=1; export AUDIOSPEAKERFORCE
 
-if (-d /usr/sony) then
-    set dev=/dev/sb0
+if test -d /usr/sony
+then
+	dev=/dev/sb0
 else
-    set dev=/dev/audio
-endif
+	dev=/dev/audio
+fi
 
-set audiofile=$1
-if (-e $audiofile && ! -z $audiofile) goto whatnext
+audiofile=$1
 
-record:
-echo -n "Press RETURN when you are ready to start recording: "
-set foo = $<
-
-# THIS IS UNBELIEVABLY GRUBBY
-onintr cleanup
-if (! $?RECORD_AUDIO) then
-    (/bin/cat < $dev > $audiofile) &
+if test -f "$audiofile" -a -s "$audiofile"
+then
+	whatnext=1
 else
-    ($RECORD_AUDIO > $audiofile) &
-endif
-jobs -l > ${METAMAIL_TMPDIR}/AUDCAT.$$
-set foo=`/bin/cat ${METAMAIL_TMPDIR}/AUDCAT.$$`
-/bin/rm ${METAMAIL_TMPDIR}/AUDCAT.$$
-set PID=$foo[2]
-echo -n "press RETURN when you are done recording: "
-set foo=$<
-echo One moment please...
-/bin/sleep 1
-echo -n Killing recording job...
-/bin/kill -9 $PID >& /dev/null
-
-whatnext:
-echo ""
-echo "What do you want to do?"
-echo ""
-echo "1 -- Listen to recorded message"
-echo "2 -- Replace with a new recording"
-echo "3 -- All Done, Quit"
-set which = $<
-    switch ("$which")
-        case 1:
-          cat $audiofile > $dev
-          breaksw
-        case 2:
-          goto record
-        case 3:
-          exit
-    endsw
-goto whatnext
-exit 0
-cleanup:
-kill -9 $PID >& /dev/null
+	whatnext=0
+fi
+
+while true
+do
+	if test $whatnext -eq 1
+	then
+		echo ""
+		echo "What do you want to do?"
+		echo ""
+		echo "1 -- Listen to recorded message"
+		echo "2 -- Replace with a new recording"
+		echo "3 -- All Done, Quit"
+		read which
+		case $which in
+			1) cat "$audiofile" > $dev ;;
+			2) whatnext=0 ;;
+			3) exit 0 ;;
+		esac
+	fi
+	echo -n "Press RETURN when you are ready to start recording: "
+	read foo
+
+	trap "kill -9 $! > /dev/null 2>&1" 1 2 15
+	if test -z "$RECORD_AUDIO"
+	then
+		(cat < $dev > "$audiofile") &
+	else
+		($RECORD_AUDIO > "$audiofile") &
+	fi
+	echo -n "press RETURN when you are done recording: "
+	read foo
+	echo One moment please...
+	/bin/sleep 1
+	echo -n Killing recording job...
+	/bin/kill -9 $! > /dev/null 2>&1
+	whatnext=1
+done
--- metamail-2.7.orig/bin/rcvAppleSingle
+++ metamail-2.7/bin/rcvAppleSingle
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/sh -e
 #
 # Very simple shellscript to support recieving Macintosh files
 # and store them in a UNIX filesystem used by the CAP AUFS program.
--- metamail-2.7.orig/bin/sun-to-mime
+++ metamail-2.7/bin/sun-to-mime
@@ -1,14 +1,20 @@
-#!/bin/csh -fb
-# (The "-fb" might need to be changed to "-f" on some systems)
-#
-# Provide VERY minimal support for mail generated by Sun's Openwindows mailtool.
-# Basically, this lets you see the text part, but not much else...
+#!/bin/sh -e
+# This file Copyright (c) 1992 Z-Code Software Corp.
+# Permission to use, copy, modify, and distribute this material
+# for any purpose and without fee is hereby granted, provided
+# that the above copyright notice and this permission notice
+# appear in all copies, and that the name of Z-Code Software not
+# be used in advertising or publicity pertaining to this
+# material without the specific, prior written permission
+# of an authorized representative of Z-Code.  Z-CODE SOFTWARE
+# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
+# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
+# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
 
-if (! $?METAMAIL_TMPDIR) then
-    set METAMAIL_TMPDIR=/tmp
-endif
+# Brought into line with metamail 2.7 beta release Csh version
+#    Dave Shield	February 1994
 
-set TMPFILE=${METAMAIL_TMPDIR}/suntomime.$$
+TMPFILE=`tempfile -p metamail -m 600`
 echo "Content-type: multipart/mixed; boundary=--------" > $TMPFILE
 echo "" >> $TMPFILE
 sed -e 's/X-Sun-Data-Type:/Content-type:/' >> $TMPFILE < $1
--- metamail-2.7.orig/bin/getfilename
+++ metamail-2.7/bin/getfilename
@@ -1,16 +1,36 @@
-#!/bin/csh -fb
-# (The "-fb" might need to be changed to "-f" on some systems)
-#
+#!/bin/sh -e
+# Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
+# 
+# Permission to use, copy, modify, and distribute this material 
+# for any purpose and without fee is hereby granted, provided 
+# that the above copyright notice and this permission notice 
+# appear in all copies, and that the name of Bellcore not be 
+# used in advertising or publicity pertaining to this 
+# material without the specific, prior written permission 
+# of an authorized representative of Bellcore.  BELLCORE 
+# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
+# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
+# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+
+# Conversion from C shell to Bourne shell by Z-Code Software Corp.
+# Conversion Copyright (c) 1992 Z-Code Software Corp.
+# Permission to use, copy, modify, and distribute this material
+# for any purpose and without fee is hereby granted, provided
+# that the above copyright notice and this permission notice
+# appear in all copies, and that the name of Z-Code Software not
+# be used in advertising or publicity pertaining to this
+# material without the specific, prior written permission
+# of an authorized representative of Z-Code.  Z-CODE SOFTWARE
+# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
+# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
+# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
 
 echo -n "Enter the name of a file in '$1' format: "
-set fnam=$<
-if ("" == "$fnam") then
-    echo Aborted
-    exit -1
-endif
-if (! -r  $fnam) then
-    echo No such file
-    exit -1
-endif
-cp $fnam $2
-exit 0
+read fnam
+if test ! -r "$fnam"
+then
+	echo No such file
+	exit 1
+fi
+
+cp "$fnam" "$2"
--- metamail-2.7.orig/bin/extcompose
+++ metamail-2.7/bin/extcompose
@@ -1,103 +1,126 @@
-#!/bin/csh -fb
-# (The "-fb" might need to be changed to "-f" on some systems)
-#
-
-if ($#argv < 1) then
-    echo "Usage:  extcompose output-file-name"
+#!/bin/sh -e
+# This file Copyright (c) 1992 Z-Code Software Corp.
+# Permission to use, copy, modify, and distribute this material
+# for any purpose and without fee is hereby granted, provided
+# that the above copyright notice and this permission notice
+# appear in all copies, and that the name of Z-Code Software not
+# be used in advertising or publicity pertaining to this
+# material without the specific, prior written permission
+# of an authorized representative of Z-Code.  Z-CODE SOFTWARE
+# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
+# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
+# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+if [ $# -lt 1 ]
+then
+    echo "Usage:  $0 output-file-name" 1>&2
     exit 1
-endif
-set OUTFNAME=$1
+fi
+OUTFNAME=$1
+
+choosing=yes
+while [ $choosing = yes ]
+do
+    echo ""
+    echo "Where is the external data that you want this mail message to reference?"
+    echo "    1 -- In a local file"
+    echo "    2 -- In an AFS file"
+    echo "    3 -- In an anonymous FTP directory on the Internet"
+    echo "    4 -- In an Internet FTP directory that requires a valid login"
+    echo "    5 -- Under the control of a mail server that will send the data on request"
+    echo ""
+    echo -n "Please enter a number from 1 to 5: \c"
+    read ans
+    case "$ans" in
+        1) accesstype=local-file ;;
+	2) accesstype=afs ;;
+	3) accesstype=anon-ftp ;;
+	4) accesstype=ftp ;;
+	5) accesstype=mail-server ;;
+	* ) echo "That is NOT one of your choices." 1>&2; continue ;;
+    esac
+
+    case "$accesstype" in
+        ftp | anon-ftp )
+	    echo -n "Enter the full Internet domain name of the FTP site: "
+	    read site
+	    echo -n "Enter the name of the directory containing the file (RETURN for top-level): "
+	    read directory
+	    echo -n "Enter the name of the file itself: "
+	    read name
+	    echo -n "Enter the transfer mode (type 'image' for binary data, RETURN otherwise): "
+	    read mode
+	    if [ -n "$mode" ]
+	    then mode=ascii
+	    fi
+	    echo "Content-type: message/external-body; access-type=$accesstype; name="\"$name\"\; > "$OUTFNAME"
+	    echo -n "    site="\"$site\" >> "$OUTFNAME"
+	    if [ -n "$directory" ]
+	    then echo -n "; directory="\"$directory\">> "$OUTFNAME"
+	    fi
+	    echo -n "; mode="\"$mode\">> "$OUTFNAME"
+	    echo "">> "$OUTFNAME"
+	    choosing=no
+	    ;;
 
-chooseaccesstype:
-echo ""
-echo "Where is the external data that you want this mail message to reference?"
-echo "    1 -- In a local file"
-echo "    2 -- In an AFS file"
-echo "    3 -- In an anonymous FTP directory on the Internet"
-echo "    4 -- In an Internet FTP directory that requires a valid login"
-echo "    5 -- Under the control of a mail server that will send the data on request"
-echo ""
-echo -n "Please enter a number from 1 to 5: "
-set ans=$<
-if ($ans == 1)  then
-    set accesstype=local-file
-else if ($ans == 2) then
-    set accesstype=afs
-else if ($ans == 3) then
-    set accesstype=anon-ftp
-else if ($ans == 4) then
-    set accesstype=ftp
-else if ($ans == 5) then
-    set accesstype=mail-server
-else
-    echo "That is NOT one of your choices."
-    goto chooseaccesstype
-endif
-if ($accesstype == "ftp" || $accesstype == "anon-ftp") then
-    echo -n "Enter the full Internet domain name of the FTP site: "
-    set site=$<
-    echo -n "Enter the name of the directory containing the file (RETURN for top-level): "
-    set directory=$<
-    echo -n "Enter the name of the file itself: "
-    set name = $<
-    echo -n "Enter the transfer mode (type 'image' for binary data, RETURN otherwise): "
-    set mode = $<
-    if ($mode == "") set mode=ascii
-    echo "Content-type: message/external-body; access-type=$accesstype; name="\"$name\"\; > $OUTFNAME
-    echo -n "    site="\"$site\" >> $OUTFNAME
-    if ($directory != "") echo -n "; directory="\"$directory\">> $OUTFNAME
-    if ($mode != "") echo -n "; mode="\"$mode\">> $OUTFNAME
-    echo "">> $OUTFNAME
-else if ($accesstype == "local-file" || $accesstype == "afs") then
-fname:
-    echo -n "Enter the full path name for the file: "
-    set name = $<
-    if (! -e $name) then
-	echo "The file $name does not seem to exist."
-	goto fname
-    endif
-    echo "Content-type: message/external-body; access-type=$accesstype; name="\"$name\"> $OUTFNAME
-else if ($accesstype == "mail-server") then
-    echo -n "Enter the full email address for the mailserver: "
-    set server=$<
-    echo "Content-type: message/external-body; access-type=$accesstype; server="\"$server\"> $OUTFNAME
-else
-    echo accesstype $accesstype not yet implemented
-    goto chooseaccesstype
-endif
+	local-file | afs )
+	    name=
+	    while [ -z "$name" ]
+	    do
+	        echo -n "Enter the full path name for the file: "
+		read name
+		if [ ! -f "$name" ]
+		then
+		    echo "The file $name does not seem to exist."
+		    name=
+		fi
+	    done
+	    echo "Content-type: message/external-body; access-type=$accesstype; name="\"$name\"> "$OUTFNAME"
+	    choosing=no
+	    ;;
+	
+	mail-server )
+	    echo -n "Enter the full email address for the mailserver: "
+	    read server
+	    echo "Content-type: message/external-body; access-type=$accesstype; server="\"$server\"> "$OUTFNAME"
+	    choosing=no
+	    ;;
+	
+	* )
+	    echo accesstype "$accesstype" not yet implemented
+	    ;;
+    esac
+done
 
 echo -n "Please enter the MIME content-type for the externally referenced data: "
-set ctype = $<
-getcenc:
-echo "Is this data already encoded for email transport?"
-echo "  1 -- No, it is not encoded"
-echo "  2 -- Yes, it is encoded in base64"
-echo "  3 -- Yes, it is encoded in quoted-printable"
-echo "  4 -- Yes, it is encoded using uuencode"
-set encode=$<
-switch ("$encode")
-    case 1:
-        set cenc=""
-        breaksw
-    case 2:
-        set cenc="base64"
-        breaksw
-    case 3:
-        set cenc="quoted-printable"
-        breaksw
-    case 4:
-        set cenc="x-uue"
-        breaksw
-    default:
-        echo "That is not one of your choices."
-        goto getcenc
-endsw
-echo "" >> $OUTFNAME
-echo "Content-type: " $ctype >> $OUTFNAME
-if ($cenc != "") echo "Content-transfer-encoding: " $cenc >> $OUTFNAME
-echo "" >> $OUTFNAME
-if ($accesstype == "mail-server") then
+read ctype
+
+choosing=yes
+while [ $choosing = yes ]
+do
+    echo "Is this data already encoded for email transport?"
+    echo "  1 -- No, it is not encoded"
+    echo "  2 -- Yes, it is encoded in base64"
+    echo "  3 -- Yes, it is encoded in quoted-printable"
+    echo "  4 -- Yes, it is encoded using uuencode"
+    read encode
+    case "$encode" in
+	1 ) cenc="" choosing=no ;;
+	2 ) cenc="base64" choosing=no ;;
+	3 ) cenc="quoted-printable" choosing=no ;;
+	4 ) cenc="x-uue" choosing=no ;;
+	* ) echo "That is not one of your choices." ;;
+    esac
+done
+
+echo >> "$OUTFNAME"
+echo "Content-type: " "$ctype" >> "$OUTFNAME"
+if [ -n "$cenc" ]
+then echo "Content-transfer-encoding: " "$cenc" >> "$OUTFNAME"
+fi
+echo >> "$OUTFNAME"
+if [ "$accesstype" = "mail-server" ]
+then
     echo "Please enter all the data to be sent to the mailserver in the message body, "
     echo "ending with ^D or your usual end-of-data character:"
-    cat >> $OUTFNAME
-endif
+    cat >> "$OUTFNAME"
+fi
--- metamail-2.7.orig/bin/mailserver
+++ metamail-2.7/bin/mailserver
@@ -1,4 +1,4 @@
-#!/bin/csh -fb
+#!/bin/csh -efb
 # (The "-fb" might need to be changed to "-f" on some systems)
 #
 # Mailserver -- a simple MIME mailserver script.
@@ -18,17 +18,15 @@
 set LOCALADDR=mail-server
 set ROOTDIR=/usr/spool/ftp
 set MAINTAINER=postmaster
-set METAMAILDIR=/usr/local/bin
 set LOGADDR=andrew@thumper.bellcore.com
 # If LOGADDR is the empty string, no logging is done.
 #
 # The real program begins here.
 
-setenv PATH ${METAMAILDIR}:${PATH}
 rehash
 set FromName=""
 set Subject=""
-set TmpFile=/tmp/ms.$$
+set TmpFile=`tempfile -p metamail -m 600`
 set FOORAW=$<
 while ("$FOORAW" != "") 
 set FOO=(` echo "$FOORAW" | tr "[" "x"`)
@@ -68,7 +66,7 @@
 probably run in some circumstance other than mail delivery.
 --------------------
 !
-	cat $TmpFile - | /usr/lib/sendmail $MAINTAINER
+	cat $TmpFile - | /usr/sbin/sendmail $MAINTAINER
 	# Takes the rest of the message from standard input
 	rm $TmpFile
 	exit 0
@@ -86,7 +84,7 @@
 
 The file you requested, if it exists, will not be sent to you.
 !
-	/usr/lib/sendmail -t < $TmpFile
+	/usr/sbin/sendmail -t < $TmpFile
 	rm $TmpFile
 	exit 0
 endif
@@ -107,7 +105,7 @@
 --------------------------------
 !
 	ls -R >> $TmpFile
-	/usr/lib/sendmail -t < $TmpFile
+	/usr/sbin/sendmail -t < $TmpFile
 	rm $TmpFile
 	exit 0
 endif
@@ -135,13 +133,13 @@
   metasend -b -t "$FromName" -f "$Subject" -m "$ct" -s "Re: $Subject"
 
 !
-	/usr/lib/sendmail -t < $TmpFile
+	/usr/sbin/sendmail -t < $TmpFile
 	rm $TmpFile
 	exit 0
 endif
 
 if ("$LOGADDR" != "") then
-	/usr/lib/sendmail -t <<!
+	/usr/sbin/sendmail -t <<!
 From: ${LOCALADDR}@`hostname`
 To: $LOGADDR
 Subject: Autosend delivery report
--- metamail-2.7.orig/bin/sndAppleSingle
+++ metamail-2.7/bin/sndAppleSingle
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/sh -e
 #
 # Very simple shellscript to support sending Macintosh files
 # which are stored in a UNIX filesystem by the CAP AUFS program.
--- metamail-2.7.orig/bin/sun2mime
+++ metamail-2.7/bin/sun2mime
@@ -1,4 +1,4 @@
-#!/bin/sh -f
+#!/bin/sh -e
 #
 # This is sun2mime.  It makes a bold attempt to transform a Sun mailtool message into
 # MIME format.
@@ -6,12 +6,9 @@
 # This program is for use with sun-message which takes an arg to figure out how
 # (or if) the message is encoded.
 #
-if [ x$METAMAIL_TMPDIR = x ]; then
-    METAMAIL_TMPDIR=/tmp
-fi
-TMPFILE=${METAMAIL_TMPDIR}/suntomime.$$
+TMPFILE=`tempfile -p metamail -m 600`
 
-/bin/nawk '
+nawk '
   BEGIN { printf("Content-type: multipart/mixed; boundary=--------\n\n")
           RS=""; FS="\n"; mode="HEADER" }
   mode == "HEADER" {
@@ -36,8 +33,8 @@
       print
   }
   END { printf("----------\n") }
-' $1 > $TMPFILE
+' "$1" > $TMPFILE
 
 metamail -z $TMPFILE
-rm -f $TMPFILE
-
+rm $TMPFILE
+exit 0
--- metamail-2.7.orig/bin/sun-audio-file
+++ metamail-2.7/bin/sun-audio-file
@@ -1,12 +1,20 @@
-#!/bin/csh -fb
-# (The "-fb" might need to be changed to "-f" on some systems)
-#
+#!/bin/sh -e
+# This file Copyright (c) 1992 Z-Code Software Corp.
+# Permission to use, copy, modify, and distribute this material
+# for any purpose and without fee is hereby granted, provided
+# that the above copyright notice and this permission notice
+# appear in all copies, and that the name of Z-Code Software not
+# be used in advertising or publicity pertaining to this
+# material without the specific, prior written permission
+# of an authorized representative of Z-Code.  Z-CODE SOFTWARE
+# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
+# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
+# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
 
-if (! $?METAMAIL_TMPDIR) then
-    set METAMAIL_TMPDIR=/tmp
-endif
+# Brought into line with metamail 2.7 beta release Csh version
+#    Dave Shield	February 1994
 
-cd ${METAMAIL_TMPDIR}
-uudecode < $1
-audiotool audio-file
-rm -f audio-file $1
+audio-file=`tempfile -p metamail -m 600`
+uudecode -o $audio-file "$1"
+audiotool $audio-file
+rm $audio-file "$1"
--- metamail-2.7.orig/bin/uudepipe
+++ metamail-2.7/bin/uudepipe
@@ -0,0 +1,13 @@
+#!/bin/sh -e
+# This file Copyright (c) 1992 Z-Code Software Corp.
+# Permission to use, copy, modify, and distribute this material
+# for any purpose and without fee is hereby granted, provided
+# that the above copyright notice and this permission notice
+# appear in all copies, and that the name of Z-Code Software not
+# be used in advertising or publicity pertaining to this
+# material without the specific, prior written permission
+# of an authorized representative of Z-Code.  Z-CODE SOFTWARE
+# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
+# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
+# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+uudecode -o /dev/stdout -- ${1+"$1"}
--- metamail-2.7.orig/bin/uuenpipe
+++ metamail-2.7/bin/uuenpipe
@@ -0,0 +1,13 @@
+#!/bin/sh -e
+# This file Copyright (c) 1992 Z-Code Software Corp.
+# Permission to use, copy, modify, and distribute this material
+# for any purpose and without fee is hereby granted, provided
+# that the above copyright notice and this permission notice
+# appear in all copies, and that the name of Z-Code Software not
+# be used in advertising or publicity pertaining to this
+# material without the specific, prior written permission
+# of an authorized representative of Z-Code.  Z-CODE SOFTWARE
+# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
+# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
+# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+uuencode -- ${1+"$1"} "$(basename "${1-UUPIPEOUT}")"
--- metamail-2.7.orig/bin/sun-message
+++ metamail-2.7/bin/sun-message
@@ -0,0 +1,56 @@
+#!/bin/sh -e
+#
+#  This is sun-message.
+#  It looks at $2 to figure out how to decode $1,
+#  then gives the user a short menu of choices:
+#    display, save or quit.
+
+if [ "$2" = "uuencode" ]
+then 
+	fn=`tempfile -p metamail -m 600`
+	uudecode -o $fn "$1"
+
+	echo "The following file was uudecoded:"
+	echo
+
+	defans=1
+	while :
+	do
+		ls -l $fn
+
+		echo
+		echo "Please choose one:"
+		echo
+		echo "1 -- Display it as ASCII text"
+		echo "2 -- Save it as a file"
+		echo "3 -- Quit this menu"
+		echo
+		echo -n "Which do you prefer (1 - 3)? [$defans] "
+
+		read ans
+		if test -z "${ans:-}"
+		then
+			ans=$defans
+		fi
+
+		case $ans in
+			1)	sensible-pager $fn ;;
+			2)	echo -n "Save as: $HOME/"
+				read nfn
+				if test ! -z "${nfn:-}"
+				then
+					cp $fn "$HOME/$nfn"
+				else
+					echo Not Saved.
+				fi
+				;;
+			3)	rm "$1" $fn
+				exit 0
+				;;
+			*)	echo Invalid choice. ;;
+		esac
+		defans=3
+	done
+else
+	sensible-pager "$1"
+fi
--- metamail-2.7.orig/bin/shownonascii
+++ metamail-2.7/bin/shownonascii
@@ -0,0 +1,104 @@
+#!/bin/sh -e
+# Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
+# 
+# Permission to use, copy, modify, and distribute this material 
+# for any purpose and without fee is hereby granted, provided 
+# that the above copyright notice and this permission notice 
+# appear in all copies, and that the name of Bellcore not be 
+# used in advertising or publicity pertaining to this 
+# material without the specific, prior written permission 
+# of an authorized representative of Bellcore.  BELLCORE 
+# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
+# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
+# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+
+# Conversion from C shell to Bourne shell by Z-Code Software Corp.
+# Conversion Copyright (c) 1992 Z-Code Software Corp.
+# Permission to use, copy, modify, and distribute this material
+# for any purpose and without fee is hereby granted, provided
+# that the above copyright notice and this permission notice
+# appear in all copies, and that the name of Z-Code Software not
+# be used in advertising or publicity pertaining to this
+# material without the specific, prior written permission
+# of an authorized representative of Z-Code.  Z-CODE SOFTWARE
+# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
+# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
+# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+
+# Brought into line with metamail 2.7 beta release Csh version
+#    Dave Shield	February 1994
+
+MYFONTDIR=/usr/lib/X11/fonts/misc
+
+CHARSET=$1
+shift
+
+if test "$1" = "-e"
+then
+	shift
+	CMD="$*"
+	RIGHTTERMCMD="$*"
+else
+	CMD="more $* /dev/null"
+	RIGHTTERMCMD="more $*"
+fi
+
+if test ! -z "${MM_CHARSET:-}"
+then
+	if test "$MM_CHARSET" = "$CHARSET"
+	then
+		$RIGHTTERMCMD
+		exit 0
+	fi
+fi
+for f in "${MM_AUXCHARSETS:-}"
+do
+	if test "$f" = "$CHARSET"
+	then
+		$RIGHTTERMCMD
+		exit 0
+	fi
+done
+
+if test ! -d "$MYFONTDIR"
+then
+	echo This message contains non-ASCII text, but the $CHARSET font
+	echo has not yet been installed on this machine.  What follows
+	echo "may be partially unreadable, but the English (ASCII) parts"
+	echo "should still be readable."
+	cat $*
+	exit 0
+fi
+
+if test -z "${DISPLAY:-}"
+then
+	echo This message contains non-ASCII text, which can only be displayed
+	echo properly if you are running X11.  What follows
+	echo "may be partially unreadable, but the English (ASCII) parts"
+	echo "should still be readable."
+	cat $*
+	exit 0
+fi
+
+#
+# Do we have a font server?
+#
+if xset q | grep -q tcp/localhost:7100
+then
+    echo Your font path appears to be correctly set.
+else
+	if xset q | grep -q $MYFONTDIR
+	then
+	    echo Your font path appears to be correctly set.
+	else
+	    echo Adding $MYFONTDIR to your font path.
+	    xset +fp "$MYFONTDIR"
+	fi
+fi
+
+echo Running xterm to display text in $CHARSET, please wait...
+
+# Bogus -- need to unsetenv MM_NOTTTY, but can't in Bourne shell.  --bobg.
+MM_NOTTTY=''
+XCHARSET=\*`echo $CHARSET | sed -e s/iso-/iso/`
+xterm -fn $XCHARSET -e $CMD
--- metamail-2.7.orig/bin/Makefile.am
+++ metamail-2.7/bin/Makefile.am
@@ -0,0 +1,9 @@
+MAINTAINERCLEANFILES    = Makefile.in
+
+bin_SCRIPTS		= audiocompose audiosend extcompose getfilename \
+			mailserver mailto-hebrew metasend mimeit \
+			patch-metamail rcvAppleSingle showaudio showexternal \
+			shownonascii showpartial showpicture sndAppleSingle \
+			sun-audio-file sun-message sun-message.csh \
+			sun-to-mime sun2mime uudepipe uuenpipe
+
--- metamail-2.7.orig/bin/Makefile.in
+++ metamail-2.7/bin/Makefile.in
@@ -0,0 +1,217 @@
+# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AS = @AS@
+CATCOMMAND = @CATCOMMAND@
+CC = @CC@
+DLLTOOL = @DLLTOOL@
+ECHO = @ECHO@
+EXEEXT = @EXEEXT@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LN_S = @LN_S@
+LPRCOMMAND = @LPRCOMMAND@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_aux_dir = @ac_aux_dir@
+
+MAINTAINERCLEANFILES = Makefile.in
+
+bin_SCRIPTS = audiocompose audiosend extcompose getfilename 			mailserver mailto-hebrew metasend mimeit 			patch-metamail rcvAppleSingle showaudio showexternal 			shownonascii showpartial showpicture sndAppleSingle 			sun-audio-file sun-message sun-message.csh 			sun-to-mime sun2mime uudepipe uuenpipe
+
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = ../metamail/config.h
+CONFIG_CLEAN_FILES = 
+SCRIPTS =  $(bin_SCRIPTS)
+
+DIST_COMMON =  Makefile.am Makefile.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP_ENV = --best
+all: all-redirect
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
+	cd $(top_srcdir) && $(AUTOMAKE) --foreign bin/Makefile
+
+Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
+	cd $(top_builddir) \
+	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+install-binSCRIPTS: $(bin_SCRIPTS)
+	@$(NORMAL_INSTALL)
+	$(mkinstalldirs) $(DESTDIR)$(bindir)
+	@list='$(bin_SCRIPTS)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
+	    $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
+	  else if test -f $(srcdir)/$$p; then \
+	    echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
+	    $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
+	  else :; fi; fi; \
+	done
+
+uninstall-binSCRIPTS:
+	@$(NORMAL_UNINSTALL)
+	list='$(bin_SCRIPTS)'; for p in $$list; do \
+	  rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
+	done
+tags: TAGS
+TAGS:
+
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = bin
+
+distdir: $(DISTFILES)
+	here=`cd $(top_builddir) && pwd`; \
+	top_distdir=`cd $(top_distdir) && pwd`; \
+	distdir=`cd $(distdir) && pwd`; \
+	cd $(top_srcdir) \
+	  && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign bin/Makefile
+	@for file in $(DISTFILES); do \
+	  d=$(srcdir); \
+	  if test -d $$d/$$file; then \
+	    cp -pr $$d/$$file $(distdir)/$$file; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+	    || cp -p $$d/$$file $(distdir)/$$file || :; \
+	  fi; \
+	done
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am: install-binSCRIPTS
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am: uninstall-binSCRIPTS
+uninstall: uninstall-am
+all-am: Makefile $(SCRIPTS)
+all-redirect: all-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs:
+	$(mkinstalldirs)  $(DESTDIR)$(bindir)
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f Makefile $(CONFIG_CLEAN_FILES)
+	-rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+	-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+mostlyclean-am:  mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am:  clean-generic mostlyclean-am
+
+clean: clean-am
+
+distclean-am:  distclean-generic clean-am
+	-rm -f libtool
+
+distclean: distclean-am
+
+maintainer-clean-am:  maintainer-clean-generic distclean-am
+	@echo "This command is intended for maintainers to use;"
+	@echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-am
+
+.PHONY: uninstall-binSCRIPTS install-binSCRIPTS tags distdir info-am \
+info dvi-am dvi check check-am installcheck-am installcheck \
+install-exec-am install-exec install-data-am install-data install-am \
+install uninstall-am uninstall all-redirect all-am all installdirs \
+mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
--- metamail-2.7.orig/bin/mimeit
+++ metamail-2.7/bin/mimeit
@@ -0,0 +1,27 @@
+#!/bin/sh -e
+# mimeit - mail base64-encoded stdin
+#    with content-type $1
+#    to recipient $2
+#    with subject $3
+# All other arguments are passed on to splitmail 
+
+if [ $# -lt 3 ]; then
+	echo "Usage: $0 <content-type> <recipient> <subject> [splitmail-options]" >&2
+	exit 1
+fi
+
+ct="$1"
+to="$2"
+sub="$3"
+
+shift
+shift
+shift
+
+( echo Mime-Version: 1.0 ; \
+  echo Content-type: "$ct" ; \
+  echo To: "$to" ; \
+  echo Subject: "$sub" ; \
+  echo Content-Transfer-Encoding: base64 ;
+  echo "" ; \
+  mimencode -b ) | splitmail -d $*
--- metamail-2.7.orig/bin/mailto-hebrew
+++ metamail-2.7/bin/mailto-hebrew
@@ -0,0 +1,76 @@
+#!/bin/sh -e
+# Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
+# 
+# Permission to use, copy, modify, and distribute this material 
+# for any purpose and without fee is hereby granted, provided 
+# that the above copyright notice and this permission notice 
+# appear in all copies, and that the name of Bellcore not be 
+# used in advertising or publicity pertaining to this 
+# material without the specific, prior written permission 
+# of an authorized representative of Bellcore.  BELLCORE 
+# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
+# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
+# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+
+# Conversion from C shell to Bourne shell
+# by Bob Glickstein, Z-Code Software Corp.
+# Conversion Copyright (c) 1992 Z-Code Software Corp. (Z-Code)
+# Permission to use, copy, modify, and distribute this material
+# for any purpose and without fee is hereby granted, provided
+# that the above copyright notice and this permission notice
+# appear in all copies, and that the name of Z-Code Software not
+# be used in advertising or publicity pertaining to this
+# material without the specific, prior written permission
+# of an authorized representative of Z-Code.  Z-CODE SOFTWARE
+# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
+# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
+# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+
+# Brought into line with metamail 2.7 beta release Csh version
+#    Dave Shield	February 1994
+
+MYFONTDIR=/usr/lib/X11/fonts/misc
+
+if test ! -z "${MM_CHARSET:-}"
+then
+	if test "$MM_CHARSET" = iso-8859-8
+	then
+		mailto $*
+		exit 0
+	fi
+fi
+
+if test ! -d "$MYFONTDIR"
+then
+	echo The Hebrew font has not been installed properly on this machine.
+	exit 1
+fi
+
+if test -z "${DISPLAY:-}"
+then
+	echo Hebrew mail may only be composed under X11 or on a Hebrew terminal.
+	exit 1
+fi
+
+#
+# Do we have a font server?
+#
+FSGREP=`xset q | grep "tcp/localhost:7100"`
+if test ! -z "${FSGREP:-}"
+then
+        FPGREP=`xset q | grep $MYFONTDIR`
+        if test -z "${FPGREP:-}"
+        then
+            echo Adding $MYFONTDIR to your font path.
+            xset +fp "$MYFONTDIR"
+        else
+            echo Your font path appears to be correctly set.
+        fi
+else
+    echo Your font path appears to be correctly set.
+fi
+
+echo Running xterm to compose mail in iso-8859-8, please wait...
+
+MM_CHARSET=iso-8859-8; export MM_CHARSET
+xterm -fn \*iso-8859-8 -e mailto $*
--- metamail-2.7.orig/fonts/Makefile
+++ metamail-2.7/fonts/Makefile
@@ -10,7 +10,9 @@
 #FONTSUFFIX=fb
 #DIRBUILDER=bldfamily
 
-all: shownonascii heb6x13.${FONTSUFFIX} heb8x13.${FONTSUFFIX} heb8x13B.${FONTSUFFIX} mailto-hebrew
+RM=rm
+
+all: heb6x13.${FONTSUFFIX} heb8x13.${FONTSUFFIX} heb8x13B.${FONTSUFFIX}
 
 heb6x13.${FONTSUFFIX}: heb6x13.bdf
 #	convertfont -o heb6x13 heb6x13.bdf
@@ -36,4 +38,4 @@
 	chmod +x mailto-hebrew
 
 clean:
-	rm -f heb6x13.${FONTSUFFIX} heb8x13.${FONTSUFFIX} heb8x13B.${FONTSUFFIX}  shownonascii mailto-hebrew fonts.dir
+	$(RM) -f heb6x13.${FONTSUFFIX} heb8x13.${FONTSUFFIX} heb8x13B.${FONTSUFFIX}  shownonascii mailto-hebrew fonts.dir
--- metamail-2.7.orig/fonts/Xshownonascii
+++ metamail-2.7/fonts/Xshownonascii
@@ -1,7 +1,7 @@
 #!/bin/csh -fb
 # (The "-fb" might need to be changed to "-f" on some systems)
 #
-set MYFONTDIR=/u/nsb/lib/fonts
+set MYFONTDIR=/usr/lib/X11/fonts/misc
 
 set CHARSET="$1"
 shift
--- metamail-2.7.orig/fonts/Xmailto-hebrew
+++ metamail-2.7/fonts/Xmailto-hebrew
@@ -1,7 +1,7 @@
 #!/bin/csh -fb
 # (The "-fb" might need to be changed to "-f" on some systems)
 #
-set MYFONTDIR=/u/nsb/lib/fonts
+set MYFONTDIR=/usr/lib/X11/fonts/misc
 
 if ($?MM_CHARSET) then
     if ($MM_CHARSET == iso-8859-8) then
--- metamail-2.7.orig/man/metasend.1
+++ metamail-2.7/man/metasend.1
@@ -12,7 +12,7 @@
 
 With no arguments, the program will ask the user for the To, Subject, and CC fields.  It will then ask for the name of a MIME content-type.  Next, it will ask the user for the name of an existing file containing that type of data.  After this, it will ask what encoding type, if any, should be applied to this data.  Finally, it  will ask if the user wants to  include information  from an additional file, in which case the last three questions will be repeated for  the next file.
 
-Alternately, all of this information can be provided on the comand line, using the following options:
+Alternately, all of this information can be provided on the command line, using the following options:
 
     -b -- specifies Batch (non-interactive) Mode.  Will exit with an error message if all additional needed information is not provided on the command line.
     -c cc -- specifies the CC address
--- metamail-2.7.orig/man/mailto.1
+++ metamail-2.7/man/mailto.1
@@ -1,6 +1,6 @@
 .TH MAILTO 1 "Release 1" "Bellcore Prototype"
 .SH NAME
-mailto - Simple mutlimedia mail sending program
+mailto - Simple multimedia mail sending program
 .SH SYNOPSIS
 .ta 8n
 \fBmailto\fP	[-a] [-c] [-s] [recipient name(s)]
@@ -74,9 +74,9 @@
 
 Basically, mailto can include the following things in mail:
 
-1.  Simple formatted text, using the MIME type "text/richtext".  This allows you to add emphasis to your message using underlining, bold text, italic (diaplsyed as reverse video), centering, and the like.
+1.  Simple formatted text, using the MIME type "text/richtext".  This allows you to add emphasis to your message using underlining, bold text, italic (displayed as reverse video), centering, and the like.
 
-2.  Non-text data.  Metamail can include pictures, sounds, and other non-textual data in the middle of any mail message.  The mailcap configuration mechanism can even make this process reasonably user-friendly, but a knowledgable user can include non-textual data even in the absence of a proper mailcap entry.
+2.  Non-text data.  Metamail can include pictures, sounds, and other non-textual data in the middle of any mail message.  The mailcap configuration mechanism can even make this process reasonably user-friendly, but a knowledgeable user can include non-textual data even in the absence of a proper mailcap entry.
 
 3.  Text including non-ASCII characters, such as Hebrew or Russian.  Currently, mailto directly supports only the ISO-8859-* family of character sets, which means that it does not meet the needs of Asian users, in particular.  However, languages that can not be expressed in the ISO-8859 family can still be included in the same way non-text data can be included.
 
@@ -230,7 +230,7 @@
    dot -- controls whether or not a period alone on a line 
         should be interpreted as terminating your mail
    ignore -- controls whether or not interrupts are ignored
-   verbose -- controls the verbosity of output from /usr/lib/sendmail
+   verbose -- controls the verbosity of output from /usr/sbin/sendmail
    quiet -- controls the verbosity of output from the mailto program.
    keepblind -- controls whether or not a 'blind' copy of the mail is kept.
   commasonly -- controls whether or not a space character
@@ -275,7 +275,7 @@
 
 .I 
 Altered editing behavior:
-The ~e and ~v commands, which are used to edit the message being composed, will behave differently in mailto if the mail includes non-text portions.  In such cases, each part will be edited separately, in sequence, which makes it impossble for the user to accidentally mess up the inter-part boundaries.  Moreover, if the mailcap entry for a given data type includes an "edit" field, the user will be given the choice of editing with the program named there or editing with his usual (text) editor.  In most cases, this will be a choice between using a structured editor or editing the raw data stream.
+The ~e and ~v commands, which are used to edit the message being composed, will behave differently in mailto if the mail includes non-text portions.  In such cases, each part will be edited separately, in sequence, which makes it impossible for the user to accidentally mess up the inter-part boundaries.  Moreover, if the mailcap entry for a given data type includes an "edit" field, the user will be given the choice of editing with the program named there or editing with his usual (text) editor.  In most cases, this will be a choice between using a structured editor or editing the raw data stream.
 
 .I 
 Altered behavior for large messages:
@@ -283,7 +283,7 @@
 
 .I
 New -r command-line option 
-The -r comand-line option is not found in standard Berkeley mail.
+The -r command line option is not found in standard Berkeley mail.
 
 .SH SUMMARY OF OPTIONS
 -a <charset> -- specifies an alternate character set in use.  This had better be the one your terminal is actually using.  Currently it must be in the iso-8859 character set family.
--- metamail-2.7.orig/man/metamail.1
+++ metamail-2.7/man/metamail.1
@@ -38,6 +38,9 @@
 .B \-e 
 This option tells metamail to "eat" leading newlines in message bodies.  This is particularly useful for MH-format mail.
 .TP 8
+.B \-E <contentencoding>
+This option tells metamail to use the specified content transfer encoding rather than the one in the headers, if any.  
+.TP 8
 .B \-f <address>
 This option specifies the name of the sender of the message.  Otherwise, this is determined from the header, if possible.  This information will be placed in the environment to make it available to any interpreters called by metamail.
 .TP 8
@@ -63,7 +66,7 @@
 This option specifies that it is OK to run as root.  By default, metamail refuses to run if the real or effective user id is root.  You can get the same effect using the MM_RUNASROOT environment variable.
 .TP 8
 .B \-R
-This option specifies that the /usr/ucb/reset should be executed to reset the terminal state, before any other I/O activity.
+This option specifies that the /usr/bin/reset should be executed to reset the terminal state, before any other I/O activity.
 .TP 8
 .B \-s <subject>  
 This option specifies the subject of the mail message.  By default, this information is obtained from the headers.  This information will be placed in the environment to make it available to any interpreters called by metamail.
@@ -105,11 +108,13 @@
 
 The default search path is equivalent to
 
-$HOME/.mailcap:/usr/local/etc/mailcap:/usr/etc/mailcap:/etc/mailcap:/etc/mail/mailcap:/usr/public/lib/mailcap"
+.na
+$HOME/.mailcap:\:/usr/local/etc/mailcap:\:/usr/etc/mailcap:\:/etc/mailcap:\:/etc/mail/mailcap:\:/usr/public/lib/mailcap
+.ad
 
 It can be overridden by setting the MAILCAPS environment variable.  Note: Metamail does not actually interpret environment variables such as $HOME or the "~" syntax in this path search.
 
-The format of mailcap files is explained in the manual entry for mailcap(4).
+The format of mailcap files is explained in the manual entry for mailcap(5).
 
 .SH NON-ASCII HEADER FIELDS
 Metamail has rudimentary built-in support for the emerging Internet standards for non-ASCII data in mail headers.  What this means is that such data will be recognized, decoded, and sent to the terminal.  This behavior may be more or less reasonable, depending on the character set in the header data and the capability of the user's terminal, but it will rarely be any worse than showing such data in its encoded form.
@@ -199,7 +204,7 @@
 .SH FILES
 $HOME/.mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap -- default path for mailcap files.
 .SH SEE ALSO
-audiocompose(1), audiosend(1), ezview(1), getfilename(1), mailto-hebrew(1), mailto(1), metasend(1), mmencode(1), richtext(1), showaudio(1), showexternal(1), shownonascii(1), showpartial(1), showpicture(1), mailcap(4)
+audiocompose(1), audiosend(1), ezview(1), getfilename(1), mailto-hebrew(1), mailto(1), metasend(1), mimencode(1), richtext(1), showaudio(1), showexternal(1), shownonascii(1), showpartial(1), showpicture(1), mailcap(5)
 .SH BUGS
 In a multipart/alternative body or body parts, some headers in the embedded part that should be displayed may not be displayed.  This will rarely be a problem.  Also, in a multipart/alternative, anything of type "multipart" or "message" is considered to be a recognized part, regardless of the recognizability of its contents.  This might be a problem, only further experience will tell.
 
--- metamail-2.7.orig/man/mmencode.1
+++ metamail-2.7/man/mmencode.1
@@ -1,8 +1,6 @@
 .TH MIMENCODE 1 "Release 1" "Bellcore Prototype"
 .SH NAME
 mimencode - Translate to and from mail-oriented encoding formats
-
-(Same program also installed as "mmencode".)
 .SH SYNOPSIS
 .ta 8n
 \fBmimencode\fP	[-u] [-b] [-q] [-p] [file name] [-o outputfile]
@@ -37,8 +35,6 @@
 for mail and news use.  The reason is simple:  uuencode doesn't work very well in a number of circumstances and ways.  In particular, uuencode uses characters that don't translate well across all mail gateways (particularly ASCII <-> EBCDIC gateways).  Also, uuencode is not standard -- there are several variants floating around, encoding and decoding things in different and incompatible ways, with no "standard" on which to base an implementation.  Finally, uuencode does not generally work well in a pipe, although some variants have been modified to do so.  Mimencode implements the encodings which were defined for MIME as uuencode replacements, and should be considerably more robust for email use.
 .SH SEE ALSO
 metamail(1), mailto(1)
-.SH BUGS
-This program was originally distributed as "mmencode".  That name turns out to conflict with a program of the same name that is part of the Slate software from BBN, but totally changing the name to mimencode would create other problems (notably with portability to systems where the left half of file names is limited to 8 characters).  Currently, it is being distributed with links under BOTH names.  The programs in the distribution that call the program all call it as "mimencode", so the "mmencode" version may be deleted at sites where it causes a problem.  (The source files are still named "mmencode" rather than "mimencode".)
 .SH COPYRIGHT
 Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
 
--- metamail-2.7.orig/man/richtext.1
+++ metamail-2.7/man/richtext.1
@@ -6,6 +6,8 @@
 \fBrichtext\fP [
 .B \-c
 ] [
+.B \-e
+] [
 .B \-f
 ] [
 .B \-m
@@ -53,6 +55,12 @@
 to just correct the raw richtext and write the corrected version to its
 standard output, without performing any formatting.
 .TP 8
+.B \-e
+This option directs
+.I richtext
+to interpret the input as MIME type text/enriched rather than text/richtext.
+The text/enriched format is defined in RFC 1896.
+.TP 8
 .B \-f
 This option directs
 .I richtext
--- metamail-2.7.orig/man/splitmail.1
+++ metamail-2.7/man/splitmail.1
@@ -8,23 +8,24 @@
 .SH DESCRIPTION
 The
 .I splitmail
-program will take an email message and break it up into smaller pieces using the "message/partial" type defined by MIME, the proposed Internet standard for multimedia mail formats.  
+program will take an email message and break it up into smaller pieces using the "message/partial" type defined by MIME(1), the proposed Internet standard for multimedia mail formats.  
 
 By default it will take the message either from standard input or the named file, and will produce a set of partial message files with names like "/tmp/split.1" for the first part, and so on.  The prefix "/tmp/split." can be overridden using the "-p" option.  
 
-If the -d option is specified, the mail will actually be delivered.  If -v is specified, the verbose flag will be passed to sendmail.
+If the -d option is specified, the mail will actually be delivered.  If -v is specified, the verbose flag will be passed to \fBsendmail\fR(8).
 
-The -i option can be used to make splitmail generate the pieces with similar (but not identical) message-id fields, in a format which allows them to be easily correlated with one another and which end with the suffix provided on the command line after -i.
+The -i option can be used to make \fBsplitmail\fR generate the pieces with similar (but not identical) message-id fields, in a format which allows them to be easily correlated with one another and which end with the suffix provided on the command line after -i.
 
-The default chunk size for spliting messages is 250000 at most sites, though this is also a compile-time option.  This can be overriden with the -s switch, or with the environment variable SPLITSIZE.
+The default chunk size for splitting messages is 250000 at most sites, though this is also a compile-time option.  This can be overridden with the -s switch, or with the environment variable SPLITSIZE.
 
 Messages smaller than the chunk size will not be turned into partial messages, but will be written to a single file or delivered as a single message.
 .SH ENVIRONMENT
 SPLITSIZE overrides the default chunk size.  Setting SPLITSIZE to, say, 4000000 will effectively ensure that your messages are unlikely ever to be split, but it may cause them to be rejected by some mail transport software.
 .SH SEE ALSO
-mailto(1), metamail(1)
+.PP
+\fBmailto\fR(1), \fBmetamail\fR(1), \fBMIME\fR(1), \fBmunpack\fR(1)
 .SH BUGS
-If the size of the input is just on the fencepost, and if it is coming from a file rather than standard input, splitmail will sometimes estimate the number of parts wrong and will have to write out an extra part.  This is harmless but annoying.  It is especially annoying if the estimate was 2 but the real number was 1.
+If the size of the input is just on the fencepost, and if it is coming from a file rather than standard input, \fBsplitmail\fR will sometimes estimate the number of parts wrong and will have to write out an extra part.  This is harmless but annoying.  It is especially annoying if the estimate was 2 but the real number was 1.
 .SH COPYRIGHT
 Copyright (c) 1992 Bell Communications Research, Inc. (Bellcore)
 
--- metamail-2.7.orig/man/patch-metamail.1
+++ metamail-2.7/man/patch-metamail.1
@@ -8,7 +8,7 @@
 .SH DESCRIPTION
 The
 .I patch-metamail
-program will attempt to retreive a patch file for the metamail distribution, using anonymous ftp to a trusted server, and then install that patch in your local copy of the distribution.
+program will attempt to retrieve a patch file for the metamail distribution, using anonymous ftp to a trusted server, and then install that patch in your local copy of the distribution.
 
 The first two arguments, which are required, are the root directory of your local copy of the metamail source directory, and the patch number.  The former is site-dependent, the latter is patch-dependent.
 
--- metamail-2.7.orig/man/mailcap.4
+++ metamail-2.7/man/mailcap.4
@@ -20,13 +20,9 @@
 
 can be used to indicate that the output of the 'cat' command may be voluminous, requiring either a scrolling window, a pager, or some other appropriate coping mechanism.
 
-The "type" field (text/plain, in the above example) is simply any legal content type name, as defined by RFC 822.  In practice, this is almost any string.  It is the string that will be matched against the "Content-type" header (or the value passed in with -c) to decide if this is the mailcap entry that matches the current message.  Additionally, the type field may specify a subtype (e.g. "text/ISO-8859-1") or a wildcard to match all subtypes (e.g. "image/*").
+The "type" field (text/plain, in the above example) is simply any legal content type name, as defined by informational RFC 1524.  In practice, this is almost any string.  It is the string that will be matched against the "Content-type" header (or the value passed in with -c) to decide if this is the mailcap entry that matches the current message.  Additionally, the type field may specify a subtype (e.g. "text/ISO-8859-1") or a wildcard to match all subtypes (e.g. "image/*").
 
-The "command" field is any UNIX command ("cat %s" in the above example), and is used to specify the interpreter for the given type of message.  It will be passed to the shell via the system(3) facility.  Semicolons and backslashes within the command must be quoted with backslashes.  If the command contains "%s", those two characters will be replaced by the name of a file that contains the body of the message. If it contains "%t', those two characters will be replaced by the content-type field, including the subtype, if any.  (That is, if the content-type was "image/pbm; opt1=something-else", then "%t" would be replaced by "image/pbm".)   If the command field contains  "%{" followed by a parameter name and a closing "}", then all those characters will be replaced by the value of the named parameter, if any, from the Content-type header.   Thus, in the previous example, "%{opt1}" will be replaced by "something-else".  Finally, if the command contains "\%", those two characters will be replaced by a single % ch
-
-
-
-aracter.  (In fact, the backslash can be used to quote any character, including itself.)
+The "command" field is any UNIX command ("cat %s" in the above example), and is used to specify the interpreter for the given type of message.  It will be passed to the shell via the system(3) facility.  Semicolons and backslashes within the command must be quoted with backslashes.  If the command contains "%s", those two characters will be replaced by the name of a file that contains the body of the message. If it contains "%t', those two characters will be replaced by the content-type field, including the subtype, if any.  (That is, if the content-type was "image/pbm; opt1=something-else", then "%t" would be replaced by "image/pbm".)   If the command field contains  "%{" followed by a parameter name and a closing "}", then all those characters will be replaced by the value of the named parameter, if any, from the Content-type header.   Thus, in the previous example, "%{opt1}" will be replaced by "something-else".  Finally, if the command contains "\%", those two characters will be replaced by a single % character.  (In fact, the backslash can be used to quote any character, including itself.)
 
 If no "%s" appears in the command field, then instead of placing the message body in a temporary file, metamail will pass the body to the command on the standard input.  This is helpful in saving /tmp file space, but can be problematic for window-oriented applications under some window systems such as MGR.
 
--- metamail-2.7.orig/man/uuenpipe.1
+++ metamail-2.7/man/uuenpipe.1
@@ -0,0 +1,44 @@
+.TH UUENPIPE 1 "1998 March 2nd" "METAMAIL" "Debian Linux Manual"
+.SH NAME
+uuenpipe \- uuencode a file
+.SH SYNOPSIS
+.B uuenpipe
+.RI [ filename ]
+.SH "DESCRIPTION"
+This manual page documents briefly the
+.B uuenpipe
+command.
+This manual page was written for the
+.B Debian GNU/Linux
+distribution (but may be used by others), because the original
+program does not have a manual page.
+.PP
+.B uuenpipe
+uuencodes
+.I filename
+(or the standard input if
+.I filename
+were not supplied) and prints the result to the standard output.
+When
+.I filename
+is supplied,
+.B uuenpipe
+acts as if the following command were invoked.
+.IP
+.NF
+uuencode
+.I filename
+.I filename
+.FI
+.LP
+Otherwise, it would act according to the behaviour of the next
+command.
+.IP
+.NF
+uuencode
+.I UUPIPEOUT
+.FI
+.LP
+.SH AUTHOR
+.B uuenpipe
+is part of mm package.  Manual page added by Herbert Xu.
--- metamail-2.7.orig/man/uudepipe.1
+++ metamail-2.7/man/uudepipe.1
@@ -0,0 +1,24 @@
+.TH UUDEPIPE 1 "1998 March 2nd" "METAMAIL" "Debian Linux Manual"
+.SH NAME
+uudepipe \- uudecode a file
+.SH SYNOPSIS
+.B uudepipe
+.RI [ filename ]
+.SH "DESCRIPTION"
+This manual page documents briefly the
+.B uudepipe
+command.
+This manual page was written for the
+.B Debian GNU/Linux
+distribution (but may be used by others), because the original
+program does not have a manual page.
+.PP
+.B uudepipe
+uudecodes
+.I filename
+(or the standard input if
+.I filename
+were not supplied) and prints the result to the standard output.
+.SH AUTHOR
+.B uudepipe
+is part of mm package.  Manual page added by Herbert Xu.
--- metamail-2.7.orig/man/mailcap.5
+++ metamail-2.7/man/mailcap.5
@@ -0,0 +1,69 @@
+.TH MAILCAP 5 "Release 2" "Bellcore Prototype"
+.SH NAME
+mailcap - metamail capabilities file
+.SH DESCRIPTION
+The
+.I mailcap
+file is read by the 
+.I metamail
+program to determine how to display non-text at the local site.
+
+The syntax of a mailcap file is quite simple, at least compared to termcap files.  Any line that starts with "#" is a comment.  Blank lines are ignored.  Otherwise, each line defines a single mailcap entry for a single content type.  Long lines may be continued by ending them with a backslash character, \\.
+
+Each individual mailcap entry consists of a content-type specification, a command to execute, and (possibly) a set of optional "flag" values.  For example, a very simple mailcap entry (which is actually a built-in default behavior for metamail) would look like this:
+
+text/plain; cat %s
+
+The optional flags can be used to specify additional information about the mail-handling command.  For example:
+
+text/plain; cat %s; copiousoutput
+
+can be used to indicate that the output of the 'cat' command may be voluminous, requiring either a scrolling window, a pager, or some other appropriate coping mechanism.
+
+The "type" field (text/plain, in the above example) is simply any legal content type name, as defined by informational RFC 1524.  In practice, this is almost any string.  It is the string that will be matched against the "Content-type" header (or the value passed in with -c) to decide if this is the mailcap entry that matches the current message.  Additionally, the type field may specify a subtype (e.g. "text/ISO-8859-1") or a wildcard to match all subtypes (e.g. "image/*").
+
+The "command" field is any UNIX command ("cat %s" in the above example), and is used to specify the interpreter for the given type of message.  It will be passed to the shell via the system(3) facility.  Semicolons and backslashes within the command must be quoted with backslashes.  If the command contains "%s", those two characters will be replaced by the name of a file that contains the body of the message. If it contains "%t', those two characters will be replaced by the content-type field, including the subtype, if any.  (That is, if the content-type was "image/pbm; opt1=something-else", then "%t" would be replaced by "image/pbm".)   If the command field contains  "%{" followed by a parameter name and a closing "}", then all those characters will be replaced by the value of the named parameter, if any, from the Content-type header.   Thus, in the previous example, "%{opt1}" will be replaced by "something-else".  Finally, if the command contains "\%", those two characters will be replaced by a single % character.  (In fact, the backslash can be used to quote any character, including itself.)
+
+If no "%s" appears in the command field, then instead of placing the message body in a temporary file, metamail will pass the body to the command on the standard input.  This is helpful in saving /tmp file space, but can be problematic for window-oriented applications under some window systems such as MGR.
+
+Two special codes can appear in the viewing command for objects of type multipart (any subtype).  These are "%n" and "%F".  %n will be replaced by the number of parts within the multipart object.  %F will be replaced by a series of arguments, two for each part, giving first the content-type and then the name of the temporary file where the decoded part has been stored.  In addition, for each file created by %F, a second file is created, with the same name followed by "H", which contains the header information for that body part.  This will not be needed by most multipart handlers, but it is there if you ever need it.  
+
+The "notes=xxx" field is an uninterpreted string that is used to specify the name of the person who installed this entry in the mailcap file.  (The "xxx" may be replaced by any text string.)
+
+The "test=xxx" field is a command that is executed to determine whether or not the mailcap line actually applies.  That is, if the content-type field matches the content-type on the message, but a "test=" field is present, then the test must succeed before the mailcap line is considered to "match" the message being viewed.  The command may be any UNIX command, using the same syntax and the same %-escapes as for the viewing command, as described above.  A command is considered to succeed if it exits with a zero exit status, and to fail otherwise.
+
+The "print=xxx" field is a command that is executed to print the data instead of display it interactively.  This behavior is usually a consequence of invoking metamail with the "-h" switch.
+
+The "textualnewlines" field can be used in the rather obscure case where metamail's default rules for treating newlines in base64-encoded data are unsatisfactory.  By default, metamail will translate CRLF to the local newline character in decoded base64 output if the content-type is "text" (any subtype), but will not do so otherwise.  A mailcap entry with a field of "textualnewlines=1" will force such translation for the specified content-type, while "textualnewlines=0" will guarantee that the translation does not take place even for textual content-types.
+
+The "compose" field may be used to specify a program that can be used to compose a new body or body part in the given format.  Its intended use is to support mail composing agents that support the composition of multiple types of mail using external composing agents. As with the view-command, the compose command will be executed after replacing certain escape sequences starting with "%".  In particular, %s should be replaced by the name of a file to which the composed data is to be written by the specified composing program, thus allowing th3e calling program (e.g. metamail) to tell the called program where to store the composed data.  If %s does not appear, then the composed data will be assumed to be written by the composing programs to standard output.   The result of the composing program may be data that is NOT yet suitable for mail transport -- that is, a Content-Transfer-Encoding may still need to be applied to the data.
+
+The "composetyped" field is similar to the "compose" field, but is to be used when the composing program needs to specify the Content-type header field to be applied to the composed data.  The "compose" field is simpler, and is preferred for use with existing (non-mail-oriented) programs for composing data in a given format.  The "composetyped" field is necessary when the Content-type information must include auxilliary parameters, and the composition program must then know enough about mail formats to produce output that includes the mail type information, and to apply any necessary Content-Transfer-Encoding.   Conceptually, "compose" specifies a program that simply outputs the specified type of data in its raw form, while "composetyped" specifies a program that outputs the data as a MIME object, with all necessary Content-* headers already in place.
+
+.TP 8
+.B needsterminal
+If this flag is given, the named interpreter needs to interact with the user on a terminal.  In some environments (e.g. a window-oriented mail reader under X11) this will require the creation of a new terminal emulation window, while in most environments it will not.  If the mailcap entry specifies "needsterminal" and metamail is not running on a terminal (as determined by isatty(3), the -x option, and the MM_NOTTTY environment variable) then metamail will try to run the command in a new terminal emulation window.  Currently, metamail knows how to create new windows under the X11, SunTools, and WM window systems.
+.TP 8
+.B copiousoutput
+This flag should be given whenever the interpreter is capable of producing more than a few lines of output on stdout, and does no interaction with the user.  If the mailcap entry specifies copiousoutput, and pagination has been requested via the "-p" command, then the output of the command being executed will be piped through a pagination program ("more" by default, but this can be overridden with the METAMAIL_PAGER environment variable).
+.SH BUILT-IN CONTENT-TYPE SUPPORT
+The metamail program has built-in support for a few key content-types.  In particular, it supports the text type, the multipart and multipart/alternative type, and the message/rfc822 types.  This support is incomplete for many subtypes -- for example, it only supports US-ASCII text in general.  This kind of built-in support can be OVERRIDDEN by an entry in any mailcap file on the user's search path.  Metamail also has rudimentary built-in support for types that are totally unrecognized -- i.e. for which no mailcap entry or built-in handler exists.  For such unrecognized types, metamail will write a file with a "clean" copy of the data -- i.e. a copy in which all mail headers have been removed, and in which any 7-bit transport encoding has been decoded.
+.SH FILES
+$HOME/.mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap -- default path for mailcap files.
+.SH SEE ALSO
+metamail(1)
+.SH COPYRIGHT
+Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
+
+Permission to use, copy, modify, and distribute this material 
+for any purpose and without fee is hereby granted, provided 
+that the above copyright notice and this permission notice 
+appear in all copies, and that the name of Bellcore not be 
+used in advertising or publicity pertaining to this 
+material without the specific, prior written permission 
+of an authorized representative of Bellcore.  BELLCORE 
+MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
+OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
+WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+.SH AUTHOR
+Nathaniel S. Borenstein
--- metamail-2.7.orig/metamail/splitmail.c
+++ metamail-2.7/metamail/splitmail.c
@@ -41,8 +41,8 @@
 #define VERBOSEDELIVERYCMD VerboseDeliveryCmd
 #else
 extern char *getenv();
-#define NORMALDELIVERYCMD "/usr/lib/sendmail -t -oi"
-#define VERBOSEDELIVERYCMD "/usr/lib/sendmail -t -v -oi"
+#define NORMALDELIVERYCMD "/usr/sbin/sendmail -t -oi"
+#define VERBOSEDELIVERYCMD "/usr/sbin/sendmail -t -v -oi"
 #endif
 
 usageexit() {
@@ -194,7 +194,7 @@
 	s = endofheader(from);  /* would be index(from, '\n'),
 				 but need to check for continuation lines */
         *s = '\0';
-	if (ShareThisHeader(from, SubjectBuf, &OrigID)) {
+	if (ShareThisHeader(from, SubjectBuf, sizeof (SubjectBuf), &OrigID)) {
 	    strcat(SharedHeaders, from);
 	    strcat(SharedHeaders, "\n");
 	}
@@ -339,9 +339,10 @@
     NULL
 };
 
-ShareThisHeader(s, SubjectBuf, OrigID)
+ShareThisHeader(s, SubjectBuf, size, OrigID)
 char *s;
 char *SubjectBuf;
+size_t size;
 char **OrigID;
 {
     int i;
@@ -361,7 +362,8 @@
     }
     if (!ULstrcmp(s, "subject")) {
         *colon = ':';
-        strcpy(SubjectBuf, ++colon);
+	strncpy(SubjectBuf, ++colon, size);
+	SubjectBuf[size - 1] = '\0';
         return(0);
     }
     if (!ULstrcmp(s, "content-type")) {
--- metamail-2.7.orig/metamail/dlist.c
+++ metamail-2.7/metamail/dlist.c
@@ -0,0 +1,176 @@
+#include "common.h"
+#include "dlist.h"
+
+/* null structure to easy initializing to NULL */
+const DList DListNULL = { NULL, NULL };
+
+/* create a new dlist node containing data */
+DListEntry* 
+dlist_new(void* data) {
+  DListEntry* new = XMALLOC( DListEntry, 1 );
+  
+  new->next = NULL;
+  new->prev = NULL;
+  new->data = data;
+
+  return new;
+}
+
+/* concatenate two lists */
+void
+dlist_cat(DList* list1, DList* list2){
+  list1->tail->next = list2->head;
+  list2->head->prev = list1->tail;
+  list1->tail = list2->tail;
+}
+
+/* to shorten things a bit in some cases */
+DListEntry*
+dlist_insertnew(DList* list, void* data, DListEntry* pos) {
+  DListEntry* new = dlist_new( data );
+  return dlist_insert( list, new, pos );
+}
+
+/* can be used to insert an entry at a specific position in a dlist.
+   use with caution on empty list, cause it might fail then. */
+DListEntry*
+dlist_insert(DList* list, DListEntry* new, DListEntry* pos) {
+
+  if ( pos ) { // if pos not null, insert
+    new->next = pos->next;
+    pos->next = new;
+    new->prev = pos;
+  } else if( ! list->head && ! list->tail ) { // otherwise treat as empty
+    new->next = NULL;                         // list
+    new->prev = NULL;
+    list->head = new;
+  } else
+    return NULL;    // not an empty list -> error
+  
+  if ( new->next )  // set tail when tail
+    new->next->prev = new;
+  else
+    list->tail = new;
+  
+  return new;
+}
+
+/* can only be used to append to the end of a list */
+DListEntry*
+dlist_append(DList* list, DListEntry* new) {
+  if ( list->tail ) { // if list tail exists, then link with it
+    new->next = list->tail->next;
+    list->tail->next = new;
+  } else {
+    new->next = NULL;
+    list->head = new;
+  }
+
+  new->prev = list->tail;
+
+  if ( new->next )  // if next is defined, then set its prev value correctly
+    new->next->prev = new;
+  else
+    list->tail = new;
+  
+  return new;
+}
+
+
+
+DListEntry* 
+dlist_insert_sort (DList* list, DListEntry* new, dlist_comp cmp) {
+  
+}
+
+/* retrieves the head of a list */
+DListEntry* 
+dlist_head(DList* list) {
+  DListEntry *help = list->tail;
+  DListEntry *old  = NULL;
+  
+  while( help ) {
+    old = help;
+    help = help->prev;
+  }
+  
+  return old;
+}
+
+/* retrieves the tail of a list */
+DListEntry* 
+dlist_tail(DList* list) {
+  DListEntry *help = list->head;
+  DListEntry *old  = NULL;
+
+  while( help ) {
+    old = help;
+    help = help->next;
+  }
+  
+  return old;
+}
+
+/* returns the length of the list */
+size_t 
+dlist_length(DList* list){
+  DListEntry *help = list->head;
+  size_t n;
+
+  for (n = 0; help; ++n)
+    help = help->next;
+
+  return n;
+}
+
+/* removes an entry from the list, and returns it so that it might
+   be destroyed properly */
+DListEntry*
+dlist_remove(DList* list, DListEntry* entry) {
+  if (entry) {
+    if (entry != list->head) {  // when not head
+      if (entry->prev)       // and a previous entry exists
+	entry->prev->next = entry->next; // tell the previous our next entry
+    } else
+      list->head = entry->next; // otherwise next entry is head
+    
+    if (entry != list->tail) {  // when not tail
+      if (entry->next)       // and next entry exists
+	entry->next->prev = entry->prev; // tell the next entry our previous 
+    } else
+    list->tail = entry->prev; // otherwise previous is tail
+  }
+
+  return entry;
+}
+
+/* checks a list to be ok (debugging) verifies head, tail and prints list */
+dlist_check( DList* list ) {
+  // should be implemented
+}
+
+
+DListEntry*
+dlist_search(DList* list, void* data, dlist_comp cmp) 
+{
+  DListEntry *help = list->head;
+
+  if (list) {
+    while ( help ) {
+      if ( cmp( data, help->data ) == 0 ) 
+	return help;
+      else
+	help = help->next;
+    }
+  }
+  
+  return NULL;
+}
+
+
+int
+dlist_strcmp(void* data1, void* data2)
+{
+  return strcmp( (char*) data1, (char*) data2 );
+}
+
--- metamail-2.7.orig/metamail/dlist.h
+++ metamail-2.7/metamail/dlist.h
@@ -0,0 +1,43 @@
+#ifndef COMMON_LIST_H
+#define COMMON_LIST_H 1
+
+#include <metamail/common.h>
+
+BEGIN_C_DECLS
+
+typedef int (*dlist_comp) (void*, void*);
+
+typedef struct dlistentry {
+  struct dlistentry *next;
+  struct dlistentry *prev;
+  void *data;
+} DListEntry;
+
+typedef struct dlist {
+  DListEntry *head;
+  DListEntry *tail;
+} DList;
+
+extern const DList DListNULL;
+
+extern DListEntry *dlist_new         (void* data);
+extern void        dlist_cat         (DList* list1, DList* list2);
+extern DListEntry *dlist_insert_new  (DList* list, void* data,
+				      DListEntry* pos);
+extern DListEntry *dlist_insert      (DList* list, DListEntry* new,
+				      DListEntry* pos);
+extern DListEntry *dlist_insert_sort (DList* list, DListEntry* new, 
+				      dlist_comp cmp);
+extern DListEntry *dlist_append      (DList* list, DListEntry* new);
+extern DListEntry *dlist_head        (DList* list);
+extern DListEntry *dlist_tail        (DList* list);
+extern size_t      dlist_length      (DList* list);
+extern DListEntry *dlist_remove      (DList* list, DListEntry* entry);
+
+extern DListEntry *dlist_search      (DList* list, void* data, dlist_comp cmp);
+
+extern int dlist_strcmp              (void* data1, void* data2);
+
+END_C_DECLS
+
+#endif /* !COMMON_LIST_H */
--- metamail-2.7.orig/metamail/common-h.in
+++ metamail-2.7/metamail/common-h.in
@@ -0,0 +1,162 @@
+## common-h.in -- Process this file with configure to produce common.h
+## Copyright (C) 2000 Gary V. Vaughan
+##
+## addition and changes that were made are Copyright (C) 2000 Michael Moerz
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+##  
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##  
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
+#ifndef PARAMS
+#  if __STDC__
+#    ifndef NOPROTOS
+#      define PARAMS(args)        args
+#    endif
+#  endif
+#  ifndef PARAMS
+#    define PARAMS(args)          ()
+#  endif
+#endif
+
+#ifndef EXIT_SUCCESS
+#  define EXIT_SUCCESS  0
+#  define EXIT_FAILURE  1
+#endif
+      
+#ifdef __cplusplus
+#  define BEGIN_C_DECLS         extern "C" {
+#  define END_C_DECLS           }
+#else
+#  define BEGIN_C_DECLS
+#  define END_C_DECLS
+#endif
+
+#ifdef __GNUC__
+#  ifndef const
+#    define const       __const
+#  endif
+#  ifndef signed
+#    define signed      __signed
+#  endif
+#  ifndef volatile
+#    define volatile    __volatile
+#  endif
+#else
+#  ifdef __STDC__
+#    undef  signed
+#    define signed
+#    undef  volatile
+#    define volatile
+#  endif
+#endif
+
+#ifdef __STDC__
+#  define STR(x)          #x
+#  define CONC(x, y)      x##y
+   typedef void* sic_ptr;
+#else
+#  define STR(x)          "x"
+#  define CONC(x, y)      x/**/y
+   typedef char* sic_ptr;
+#endif
+
+
+#define XCALLOC(type, num)      ((type *) xcalloc ((num), sizeof(type)))
+#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
+#define XREALLOC(type, p, num)  ((type *) xrealloc ((p), (num) * sizeof(type)))
+#define XFREE(stale)                            do {        \
+              if (stale) { free ((sic_ptr) stale);  stale = 0; }    \
+                                                      } while (0)
+
+
+BEGIN_C_DECLS
+
+extern void *xcalloc    (size_t num, size_t size);
+extern void *xmalloc    (size_t num);
+extern void *xrealloc   (void *p, size_t num);
+extern char *xstrdup    (const char *string);
+extern char *xstrerror  (int errnum);
+
+END_C_DECLS
+
+#if WITH_DMALLOC
+#  include <dmalloc.h>
+#endif
+
+//metamail specific stuff below (this are the additions from Michael Moerz)
+
+#define RESET_PROGRAM "/usr/bin/reset"
+
+//#define NO_RLIMITS 1
+#define sigtype void
+
+/* This constant should define the ASCII code for newlines on systems where 
+   the newline convention is other than CRLF.  On UNIX, it is ^J, ASCII 10. 
+    Here we define it as '\n' which should be right on MOST systems... */
+#define NEWLINE_CHAR '\n'
+
+/* The following defines the default size at which long
+    messages will be split into multiple messages of type
+    "message/partial" by the mailto and splitmail commands,
+    at least. */
+#ifndef DEFAULT_SPLIT_SIZE
+#define DEFAULT_SPLIT_SIZE 250000
+#endif
+
+#define PATH_SEPARATOR ':'
+#ifndef STDPATH
+#define STDPATH "/.mailcap:/usr/local/etc/mailcap:/usr/etc/mailcap:/etc/mailcap:/etc/mail/mailcap:/usr/public/lib/mailcap"
+#endif
+
+/* The following can be set to a directory or colon-separated list of 
+  directories that will be prepended to the user's search path before 
+  executing any mailcap-derived commands. 
+
+  It should be set to NULL if there are no directories to prepend.  
+*/
+
+#define AUXPATH NULL
+
+
+#define TMPFILE_NAME_SIZE   1000
+#define MAX_FILE_NAME_SIZE 1000
+
+BEGIN_C_DECLS
+
+extern char **environ, *gets();
+
+extern char *getenv();
+extern char *index();
+extern char *rindex();
+
+extern FILE *popen();
+
+END_C_DECLS
+
+//#ifndef NO_RLIMITS
+//#include <sys/resource.h>
+//#endif
+
+
+
--- metamail-2.7.orig/metamail/xmalloc.c
+++ metamail-2.7/metamail/xmalloc.c
@@ -0,0 +1,38 @@
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "common.h"
+#include "error.h"
+
+void *
+xmalloc (size_t num)
+{
+  void *new = malloc (num);
+  if (!new)
+    metamail_fatal ("Memory exhausted");
+  return new;
+}
+
+void *
+xrealloc (void *p, size_t num)
+{
+  void *new;
+  
+  if (!p)
+    return xmalloc (num);
+  
+  new = realloc (p, num);
+  if (!new)
+    metamail_fatal ("Memory exhausted");
+  
+  return new;
+}
+
+void *
+xcalloc (size_t num, size_t size)
+{
+  void *new = xmalloc (num * size); // is implemented by malloc, cause calloc
+  bzero (new, num * size);          // is not available in some older C libs
+  return new;
+}
--- metamail-2.7.orig/metamail/error.c
+++ metamail-2.7/metamail/error.c
@@ -0,0 +1,82 @@
+#if HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include "common.h"
+#include "error.h"
+
+#include <libgen.h>  /* basename(3) */
+const char *program_name = NULL;
+      
+static void error PARAMS((int exit_status, const char *mode,
+			  const char *message, va_list ap));
+      
+void
+set_program_name (path)
+     const char *path;
+{
+  METAMAIL_ASSERT (!program_name);
+  program_name = (char*) xstrdup ( (char*) basename (path));
+}
+
+static void
+error (exit_status, mode, message, ap)
+     int exit_status;
+     const char *mode;
+     const char *message;
+     va_list ap;
+{
+  fprintf (stderr, "%s: %s: ", program_name, mode);
+  vfprintf (stderr, message, ap);
+  fprintf (stderr, ".\n");
+
+  if (exit_status >= 0)
+    exit (exit_status);
+}
+
+void
+#if HAVE_STDARG_H
+metamail_warning (const char *message, ...)
+#else
+metamail_warning (message, va_alist)
+     const char *message;
+     va_dcl
+#endif
+{
+  va_list ap;
+  VA_START (ap, message);
+  error (-1, "warning", message, ap);
+  va_end (ap);
+}
+
+void
+#if HAVE_STDARG_H
+metamail_error (const char *message, ...)
+#else
+metamail_error (message, va_alist)
+     const char *message;
+     va_dcl
+#endif
+{
+  va_list ap;
+  VA_START (ap, message);
+  error (-1, "ERROR", message, ap);
+  va_end (ap);
+}
+      
+void
+#if HAVE_STDARG_H
+metamail_fatal (const char *message, ...)
+#else
+metamail_fatal (message, va_alist)
+     const char *message;
+     va_dcl
+#endif
+{
+  va_list ap;
+  VA_START (ap, message);
+  error (EXIT_FAILURE, "FATAL", message, ap);
+  va_end (ap);
+}
+
+
--- metamail-2.7.orig/metamail/error.h
+++ metamail-2.7/metamail/error.h
@@ -0,0 +1,17 @@
+#ifndef COMMON_ERROR_H
+#define COMMON_ERROR_H 1
+      
+#include <metamail/common.h>
+
+BEGIN_C_DECLS
+      
+extern const char *program_name;
+extern void set_program_name PARAMS((const char *argv0));
+      
+extern void metamail_warning      PARAMS((const char *message, ...));
+extern void metamail_error        PARAMS((const char *message, ...));
+extern void metamail_fatal        PARAMS((const char *message, ...));
+      
+END_C_DECLS
+      
+#endif /* !COMMON_ERROR_H */
--- metamail-2.7.orig/metamail/xstrerror.c
+++ metamail-2.7/metamail/xstrerror.c
@@ -0,0 +1,32 @@
+/* xstrerror.c -- strerror wrapper with bound checking
+   Fri Jun 16 18:30:00 1995  Pat Rankin  <rankin@eql.caltech.edu>
+   This code is in the public domain.
+*/
+
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "common.h"
+
+extern char *strerror ();
+
+/* If strerror returns NULL, we'll format the number into a static buffer.  */
+#define ERRSTR_FMT "undocumented error #%d"
+static char xstrerror_buf[sizeof ERRSTR_FMT + 20];
+
+/* Like strerror, but result is never a null pointer.  */
+char *
+xstrerror (int errnum)
+{
+  char *errstr = strerror (errnum);
+
+  /* If `errnum' is out of range, result might be NULL.  We'll fix that.  */
+  if (!errstr)
+    {
+      sprintf (xstrerror_buf, ERRSTR_FMT, errnum);
+      errstr = xstrerror_buf;
+    }
+
+  return errstr;
+}
--- metamail-2.7.orig/metamail/stamp-common
+++ metamail-2.7/metamail/stamp-common
@@ -0,0 +1 @@
+timestamp
--- metamail-2.7.orig/metamail/common.h
+++ metamail-2.7/metamail/common.h
@@ -0,0 +1,203 @@
+/*  -*- Mode: C -*-
+ * --------------------------------------------------------------------
+ * DO NOT EDIT THIS FILE!  It has been automatically generated
+ * from:    configure.in and common.h.in
+ * on host: diziet
+ * --------------------------------------------------------------------
+ */
+
+#ifndef METAMAIL_COMMON_H
+#define METAMAIL_COMMON_H 1
+
+#include <stdio.h>
+#include <ctype.h>        // ??? ok here
+#include <sys/types.h>
+#include <sys/stat.h>     // ??? ok here
+
+// ??? following ok here without check?
+#include <pwd.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#include <signal.h>
+
+#include <termio.h>
+#include <fcntl.h>
+#include <sys/utsname.h>
+
+#include <linux/limits.h>
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+
+#ifndef errno
+/* Some sytems #define this! */
+extern int errno;
+#endif
+
+#include <string.h>
+
+#include <stdarg.h>
+#ifndef VA_START
+#  define VA_START(a, f) va_start(a, f)
+#endif /* VA_START */
+
+
+#include <assert.h>
+#define METAMAIL_ASSERT assert
+
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
+#ifndef PARAMS
+#  if __STDC__
+#    ifndef NOPROTOS
+#      define PARAMS(args)        args
+#    endif
+#  endif
+#  ifndef PARAMS
+#    define PARAMS(args)          ()
+#  endif
+#endif
+
+#ifndef EXIT_SUCCESS
+#  define EXIT_SUCCESS  0
+#  define EXIT_FAILURE  1
+#endif
+      
+#ifdef __cplusplus
+#  define BEGIN_C_DECLS         extern "C" {
+#  define END_C_DECLS           }
+#else
+#  define BEGIN_C_DECLS
+#  define END_C_DECLS
+#endif
+
+#ifdef __GNUC__
+#  ifndef const
+#    define const       __const
+#  endif
+#  ifndef signed
+#    define signed      __signed
+#  endif
+#  ifndef volatile
+#    define volatile    __volatile
+#  endif
+#else
+#  ifdef __STDC__
+#    undef  signed
+#    define signed
+#    undef  volatile
+#    define volatile
+#  endif
+#endif
+
+#ifdef __STDC__
+#  define STR(x)          #x
+#  define CONC(x, y)      x##y
+   typedef void* sic_ptr;
+#else
+#  define STR(x)          "x"
+#  define CONC(x, y)      x/**/y
+   typedef char* sic_ptr;
+#endif
+
+
+#define XCALLOC(type, num)      ((type *) xcalloc ((num), sizeof(type)))
+#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
+#define XREALLOC(type, p, num)  ((type *) xrealloc ((p), (num) * sizeof(type)))
+#define XFREE(stale)                            do {        \
+              if (stale) { free ((sic_ptr) stale);  stale = 0; }    \
+                                                      } while (0)
+
+
+BEGIN_C_DECLS
+
+extern void *xcalloc    (size_t num, size_t size);
+extern void *xmalloc    (size_t num);
+extern void *xrealloc   (void *p, size_t num);
+extern char *xstrdup    (const char *string);
+extern char *xstrerror  (int errnum);
+
+END_C_DECLS
+
+#if WITH_DMALLOC
+#  include <dmalloc.h>
+#endif
+
+//metamail specific stuff below (this are the additions from Michael Moerz)
+
+#define RESET_PROGRAM "/usr/bin/reset"
+
+//#define NO_RLIMITS 1
+#define sigtype void
+
+/* This constant should define the ASCII code for newlines on systems where 
+   the newline convention is other than CRLF.  On UNIX, it is ^J, ASCII 10. 
+    Here we define it as '\n' which should be right on MOST systems... */
+#define NEWLINE_CHAR '\n'
+
+/* The following defines the default size at which long
+    messages will be split into multiple messages of type
+    "message/partial" by the mailto and splitmail commands,
+    at least. */
+#ifndef DEFAULT_SPLIT_SIZE
+#define DEFAULT_SPLIT_SIZE 250000
+#endif
+
+#define PATH_SEPARATOR ':'
+#ifndef STDPATH
+#define STDPATH "/.mailcap:/usr/local/etc/mailcap:/usr/etc/mailcap:/etc/mailcap:/etc/mail/mailcap:/usr/public/lib/mailcap"
+#endif
+
+/* The following can be set to a directory or colon-separated list of 
+  directories that will be prepended to the user's search path before 
+  executing any mailcap-derived commands. 
+
+  It should be set to NULL if there are no directories to prepend.  
+*/
+
+#define AUXPATH NULL
+
+
+#define TMPFILE_NAME_SIZE   1000
+#define MAX_FILE_NAME_SIZE 1000
+
+BEGIN_C_DECLS
+
+extern char **environ, *gets();
+
+extern char *getenv();
+extern char *index();
+extern char *rindex();
+
+extern FILE *popen();
+
+END_C_DECLS
+
+//#ifndef NO_RLIMITS
+//#include <sys/resource.h>
+//#endif
+
+
+
+#define LPRCOMMAND "lp"
+#define LPRTEMPLATE "lp %s"
+#define CATCOMMAND "cat"
+#define CATTEMPLATE "cat %s"
+#define TMPNAME_MAX NAME_MAX
+static struct termio MyTtyStateIn, MyTtyStateOut;
+
+
+
+#endif /* !METAMAIL_COMMON_H */
--- metamail-2.7.orig/metamail/Makefile.am
+++ metamail-2.7/metamail/Makefile.am
@@ -0,0 +1,27 @@
+MAINTAINERCLEANFILES	= Makefile.in
+
+INCLUDES 		= -I$(top_builddir) -I$(top_srcdir)
+
+pkginclude_HEADERS	= common.h error.h
+
+lib_LTLIBRARIES		= libmetamail.la
+
+libmetamail_la_SOURCES	= error.c dlist.c xmalloc.c xstrerror.c \
+			xstrdup.c 
+
+common.h: stamp-common
+	@:
+stamp-common: $(srcdir)/common-h.in $(top_builddir)/config.status
+	cd $(top_builddir) \
+	  && CONFIG_FILES= CONFIGHEADERS= CONFIG_OTHER=metamail/common.h \
+	  $(SHELL) ./config.status
+	echo timestamp > $@
+
+dist-hook:
+	rm -f $(distdir)/common.h
+
+
+
+
+
+
--- metamail-2.7.orig/metamail/Makefile.in
+++ metamail-2.7/metamail/Makefile.in
@@ -0,0 +1,426 @@
+# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AS = @AS@
+CATCOMMAND = @CATCOMMAND@
+CC = @CC@
+DLLTOOL = @DLLTOOL@
+ECHO = @ECHO@
+EXEEXT = @EXEEXT@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LN_S = @LN_S@
+LPRCOMMAND = @LPRCOMMAND@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_aux_dir = @ac_aux_dir@
+
+MAINTAINERCLEANFILES = Makefile.in
+
+INCLUDES = -I$(top_builddir) -I$(top_srcdir)
+
+pkginclude_HEADERS = common.h error.h
+
+lib_LTLIBRARIES = libmetamail.la
+
+libmetamail_la_SOURCES = error.c dlist.c xmalloc.c xstrerror.c 			xstrdup.c 
+
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES = 
+LTLIBRARIES =  $(lib_LTLIBRARIES)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir) -I.
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+libmetamail_la_LDFLAGS = 
+libmetamail_la_LIBADD = 
+libmetamail_la_OBJECTS =  error.lo dlist.lo xmalloc.lo xstrerror.lo \
+xstrdup.lo
+CFLAGS = @CFLAGS@
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+HEADERS =  $(pkginclude_HEADERS)
+
+DIST_COMMON =  ./stamp-h.in Makefile.am Makefile.in config.h.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP_ENV = --best
+DEP_FILES =  .deps/dlist.P .deps/error.P .deps/xmalloc.P .deps/xstrdup.P \
+.deps/xstrerror.P
+SOURCES = $(libmetamail_la_SOURCES)
+OBJECTS = $(libmetamail_la_OBJECTS)
+
+all: all-redirect
+.SUFFIXES:
+.SUFFIXES: .S .c .lo .o .obj .s
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
+	cd $(top_srcdir) && $(AUTOMAKE) --foreign metamail/Makefile
+
+Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
+	cd $(top_builddir) \
+	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+config.h: stamp-h
+	@if test ! -f $@; then \
+		rm -f stamp-h; \
+		$(MAKE) stamp-h; \
+	else :; fi
+stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
+	cd $(top_builddir) \
+	  && CONFIG_FILES= CONFIG_HEADERS=metamail/config.h \
+	     $(SHELL) ./config.status
+	@echo timestamp > stamp-h 2> /dev/null
+$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@$(srcdir)/stamp-h.in
+	@if test ! -f $@; then \
+		rm -f $(srcdir)/stamp-h.in; \
+		$(MAKE) $(srcdir)/stamp-h.in; \
+	else :; fi
+$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) 
+	cd $(top_srcdir) && $(AUTOHEADER)
+	@echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
+
+mostlyclean-hdr:
+
+clean-hdr:
+
+distclean-hdr:
+	-rm -f config.h
+
+maintainer-clean-hdr:
+
+mostlyclean-libLTLIBRARIES:
+
+clean-libLTLIBRARIES:
+	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+
+distclean-libLTLIBRARIES:
+
+maintainer-clean-libLTLIBRARIES:
+
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	$(mkinstalldirs) $(DESTDIR)$(libdir)
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    echo "$(LIBTOOL)  --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
+	    $(LIBTOOL)  --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
+	  else :; fi; \
+	done
+
+uninstall-libLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  $(LIBTOOL)  --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
+	done
+
+# FIXME: We should only use cygpath when building on Windows,
+# and only if it is available.
+.c.obj:
+	$(COMPILE) -c `cygpath -w $<`
+
+.s.o:
+	$(COMPILE) -c $<
+
+.S.o:
+	$(COMPILE) -c $<
+
+mostlyclean-compile:
+	-rm -f *.o core *.core
+	-rm -f *.$(OBJEXT)
+
+clean-compile:
+
+distclean-compile:
+	-rm -f *.tab.c
+
+maintainer-clean-compile:
+
+.s.lo:
+	$(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+.S.lo:
+	$(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+
+maintainer-clean-libtool:
+
+libmetamail.la: $(libmetamail_la_OBJECTS) $(libmetamail_la_DEPENDENCIES)
+	$(LINK) -rpath $(libdir) $(libmetamail_la_LDFLAGS) $(libmetamail_la_OBJECTS) $(libmetamail_la_LIBADD) $(LIBS)
+
+install-pkgincludeHEADERS: $(pkginclude_HEADERS)
+	@$(NORMAL_INSTALL)
+	$(mkinstalldirs) $(DESTDIR)$(pkgincludedir)
+	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
+	  echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(pkgincludedir)/$$p"; \
+	  $(INSTALL_DATA) $$d$$p $(DESTDIR)$(pkgincludedir)/$$p; \
+	done
+
+uninstall-pkgincludeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	list='$(pkginclude_HEADERS)'; for p in $$list; do \
+	  rm -f $(DESTDIR)$(pkgincludedir)/$$p; \
+	done
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS)'; \
+	unique=`for i in $$list; do echo $$i; done | \
+	  awk '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	here=`pwd` && cd $(srcdir) \
+	  && mkid -f$$here/ID $$unique $(LISP)
+
+TAGS:  $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)'; \
+	unique=`for i in $$list; do echo $$i; done | \
+	  awk '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
+	  || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP))
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+	-rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = metamail
+
+distdir: $(DISTFILES)
+	here=`cd $(top_builddir) && pwd`; \
+	top_distdir=`cd $(top_distdir) && pwd`; \
+	distdir=`cd $(distdir) && pwd`; \
+	cd $(top_srcdir) \
+	  && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign metamail/Makefile
+	@for file in $(DISTFILES); do \
+	  d=$(srcdir); \
+	  if test -d $$d/$$file; then \
+	    cp -pr $$d/$$file $(distdir)/$$file; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+	    || cp -p $$d/$$file $(distdir)/$$file || :; \
+	  fi; \
+	done
+	$(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook
+
+DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
+
+-include $(DEP_FILES)
+
+mostlyclean-depend:
+
+clean-depend:
+
+distclean-depend:
+	-rm -rf .deps
+
+maintainer-clean-depend:
+
+%.o: %.c
+	@echo '$(COMPILE) -c $<'; \
+	$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+	@-cp .deps/$(*F).pp .deps/$(*F).P; \
+	tr ' ' '\012' < .deps/$(*F).pp \
+	  | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+	    >> .deps/$(*F).P; \
+	rm .deps/$(*F).pp
+
+%.lo: %.c
+	@echo '$(LTCOMPILE) -c $<'; \
+	$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+	@-sed -e 's/^\([^:]*\)\.o[ 	]*:/\1.lo \1.o :/' \
+	  < .deps/$(*F).pp > .deps/$(*F).P; \
+	tr ' ' '\012' < .deps/$(*F).pp \
+	  | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+	    >> .deps/$(*F).P; \
+	rm -f .deps/$(*F).pp
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+all-recursive-am: config.h
+	$(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+install-exec-am: install-libLTLIBRARIES
+install-exec: install-exec-am
+
+install-data-am: install-pkgincludeHEADERS
+install-data: install-data-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am: uninstall-libLTLIBRARIES uninstall-pkgincludeHEADERS
+uninstall: uninstall-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS) config.h
+all-redirect: all-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs:
+	$(mkinstalldirs)  $(DESTDIR)$(libdir) $(DESTDIR)$(pkgincludedir)
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f Makefile $(CONFIG_CLEAN_FILES)
+	-rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+	-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+mostlyclean-am:  mostlyclean-hdr mostlyclean-libLTLIBRARIES \
+		mostlyclean-compile mostlyclean-libtool \
+		mostlyclean-tags mostlyclean-depend mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am:  clean-hdr clean-libLTLIBRARIES clean-compile clean-libtool \
+		clean-tags clean-depend clean-generic mostlyclean-am
+
+clean: clean-am
+
+distclean-am:  distclean-hdr distclean-libLTLIBRARIES distclean-compile \
+		distclean-libtool distclean-tags distclean-depend \
+		distclean-generic clean-am
+	-rm -f libtool
+
+distclean: distclean-am
+
+maintainer-clean-am:  maintainer-clean-hdr \
+		maintainer-clean-libLTLIBRARIES \
+		maintainer-clean-compile maintainer-clean-libtool \
+		maintainer-clean-tags maintainer-clean-depend \
+		maintainer-clean-generic distclean-am
+	@echo "This command is intended for maintainers to use;"
+	@echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-am
+
+.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
+mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
+clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
+uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \
+distclean-compile clean-compile maintainer-clean-compile \
+mostlyclean-libtool distclean-libtool clean-libtool \
+maintainer-clean-libtool uninstall-pkgincludeHEADERS \
+install-pkgincludeHEADERS tags mostlyclean-tags distclean-tags \
+clean-tags maintainer-clean-tags distdir mostlyclean-depend \
+distclean-depend clean-depend maintainer-clean-depend info-am info \
+dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \
+install-exec-am install-exec install-data-am install-data install-am \
+install uninstall-am uninstall all-redirect all-am all installdirs \
+mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+
+
+common.h: stamp-common
+	@:
+stamp-common: $(srcdir)/common-h.in $(top_builddir)/config.status
+	cd $(top_builddir) \
+	  && CONFIG_FILES= CONFIGHEADERS= CONFIG_OTHER=metamail/common.h \
+	  $(SHELL) ./config.status
+	echo timestamp > $@
+
+dist-hook:
+	rm -f $(distdir)/common.h
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
--- metamail-2.7.orig/metamail/libcommon.la
+++ metamail-2.7/metamail/libcommon.la
@@ -0,0 +1,28 @@
+# libcommon.la - a libtool library file
+# Generated by ltmain.sh - GNU libtool 1.3.5 (1.385.2.206 2000/05/27 11:12:27)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname=''
+
+# Names of this library.
+library_names='libcommon.so.0.0.0 libcommon.so.0 libcommon.so'
+
+# The name of the static archive.
+old_library='libcommon.a'
+
+# Libraries that this one depends upon.
+dependency_libs=''
+
+# Version information for libcommon.
+current=0
+age=0
+revision=0
+
+# Is this an already installed library?
+installed=no
+
+# Directory that this library needs to be installed in:
+libdir='/usr/lib'
--- metamail-2.7.orig/metamail/config.h.in
+++ metamail-2.7/metamail/config.h.in
@@ -0,0 +1,119 @@
+/* metamail/config.h.in.  Generated automatically from configure.in by autoheader 2.13.  */
+
+/* Define to empty if the keyword does not work.  */
+#undef const
+
+/* Define to `unsigned' if <sys/types.h> doesn't define.  */
+#undef size_t
+
+/* Define if you have the ANSI C header files.  */
+#undef STDC_HEADERS
+
+/* Define if you can safely include both <sys/time.h> and <time.h>.  */
+#undef TIME_WITH_SYS_TIME
+
+/* Define if you have the basename function.  */
+#undef HAVE_BASENAME
+
+/* Define if you have the bcmp function.  */
+#undef HAVE_BCMP
+
+/* Define if you have the bcopy function.  */
+#undef HAVE_BCOPY
+
+/* Define if you have the bzero function.  */
+#undef HAVE_BZERO
+
+/* Define if you have the calloc function.  */
+#undef HAVE_CALLOC
+
+/* Define if you have the index function.  */
+#undef HAVE_INDEX
+
+/* Define if you have the initstate function.  */
+#undef HAVE_INITSTATE
+
+/* Define if you have the kill function.  */
+#undef HAVE_KILL
+
+/* Define if you have the killpg function.  */
+#undef HAVE_KILLPG
+
+/* Define if you have the memcmp function.  */
+#undef HAVE_MEMCMP
+
+/* Define if you have the memcpy function.  */
+#undef HAVE_MEMCPY
+
+/* Define if you have the memset function.  */
+#undef HAVE_MEMSET
+
+/* Define if you have the putenv function.  */
+#undef HAVE_PUTENV
+
+/* Define if you have the rand function.  */
+#undef HAVE_RAND
+
+/* Define if you have the random function.  */
+#undef HAVE_RANDOM
+
+/* Define if you have the rindex function.  */
+#undef HAVE_RINDEX
+
+/* Define if you have the srand function.  */
+#undef HAVE_SRAND
+
+/* Define if you have the strchr function.  */
+#undef HAVE_STRCHR
+
+/* Define if you have the strerror function.  */
+#undef HAVE_STRERROR
+
+/* Define if you have the strrchr function.  */
+#undef HAVE_STRRCHR
+
+/* Define if you have the vfprintf function.  */
+#undef HAVE_VFPRINTF
+
+/* Define if you have the <assert.h> header file.  */
+#undef HAVE_ASSERT_H
+
+/* Define if you have the <dlfcn.h> header file.  */
+#undef HAVE_DLFCN_H
+
+/* Define if you have the <errno.h> header file.  */
+#undef HAVE_ERRNO_H
+
+/* Define if you have the <signal.h> header file.  */
+#undef HAVE_SIGNAL_H
+
+/* Define if you have the <stdarg.h> header file.  */
+#undef HAVE_STDARG_H
+
+/* Define if you have the <stdlib.h> header file.  */
+#undef HAVE_STDLIB_H
+
+/* Define if you have the <string.h> header file.  */
+#undef HAVE_STRING_H
+
+/* Define if you have the <strings.h> header file.  */
+#undef HAVE_STRINGS_H
+
+/* Define if you have the <sys/time.h> header file.  */
+#undef HAVE_SYS_TIME_H
+
+/* Define if you have the <time.h> header file.  */
+#undef HAVE_TIME_H
+
+/* Define if you have the <unistd.h> header file.  */
+#undef HAVE_UNISTD_H
+
+/* Define if you have the <varargs.h> header file.  */
+#undef HAVE_VARARGS_H
+
+/* Name of package */
+#undef PACKAGE
+
+/* Version number of package */
+#undef VERSION
+
--- metamail-2.7.orig/metamail/stamp-h.in
+++ metamail-2.7/metamail/stamp-h.in
@@ -0,0 +1 @@
+timestamp
--- metamail-2.7.orig/metamail/patchlevel.h
+++ metamail-2.7/metamail/patchlevel.h
@@ -0,0 +1,19 @@
+/* This is the metamail distribution, version number as given below.
+
+Version history:
+
+  Version 1.X was Bellcore-internal and pre-MIME.
+  Version 2.0 was the first MIME-compliant release, also Bellcore-internal.
+  Version 2.1 was the first public release, January 1992.
+  Version 2.2 was the second public release, April 1992.  Major changes included:
+      -- Ports to UNIX variants & MS-DOS.
+      -- The new "mailto" program
+      -- Innumerable smaller fixes & enhancements
+  Version 2.3 was the June, 1992 release, with many more patches and 
+      enhancements, including a Commodore Amiga port.
+  Version 2.4 was the December, 1992 release, including many bug fixes and a vastly expanded (and now separately packaged) contrib directory.
+  Version 2.5 was the June, 1993 release, with mostly just bug fixes from 2.4.
+  Version 2.6 was the July, 1993 release, with important bug fixes from 2.5.
+  Version 2.7 was the February, 1994 release, mostly bug fixes.
+*/
+#define MM_VERSTRING "2.7"
--- metamail-2.7.orig/metamail/xstrdup.c
+++ metamail-2.7/metamail/xstrdup.c
@@ -0,0 +1,35 @@
+/* xstrdup.c -- strdup implementation with out of memory reporting
+   Copyright (C) 2000 Gary V. Vaughan
+  
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+  
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+  
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef WITH_DMALLOC
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "common.h"
+
+char *
+xstrdup (string)
+     const char *string;
+{
+  return string ? strcpy (xmalloc (strlen (string) + 1), string) : NULL;
+}
+
+#endif /* !WITH_DMALLOC */
+
--- metamail-2.7.orig/src/metamail/codes.c
+++ metamail-2.7/src/metamail/codes.c
@@ -0,0 +1,432 @@
+/*
+Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
+
+Permission to use, copy, modify, and distribute this material 
+for any purpose and without fee is hereby granted, provided 
+that the above copyright notice and this permission notice 
+appear in all copies, and that the name of Bellcore not be 
+used in advertising or publicity pertaining to this 
+material without the specific, prior written permission 
+of an authorized representative of Bellcore.  BELLCORE 
+MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
+OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
+WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+*/
+#include <metamail/common.h>
+
+extern char *index();
+static char basis_64[] =
+   "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+static char index_64[128] = {
+    -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
+    -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
+    -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63,
+    52,53,54,55, 56,57,58,59, 60,61,-1,-1, -1,-1,-1,-1,
+    -1, 0, 1, 2,  3, 4, 5, 6,  7, 8, 9,10, 11,12,13,14,
+    15,16,17,18, 19,20,21,22, 23,24,25,-1, -1,-1,-1,-1,
+    -1,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40,
+    41,42,43,44, 45,46,47,48, 49,50,51,-1, -1,-1,-1,-1
+};
+
+#define char64(c)  (((c) < 0 || (c) > 127) ? -1 : index_64[(c)])
+
+/*
+char64(c)
+char c;
+{
+    char *s = (char *) index(basis_64, c);
+    if (s) return(s-basis_64);
+    return(-1);
+}
+*/
+
+/* the following gets a character, but fakes it properly into two chars if there's a newline character */
+static int InNewline=0;
+
+int nextcharin(infile, PortableNewlines)
+FILE *infile;
+int PortableNewlines;
+{
+    int c;
+
+#ifndef NEWLINE_CHAR
+    return(getc(infile));
+#else
+    if (!PortableNewlines) return(getc(infile));
+    if (InNewline) {
+        InNewline = 0;
+        return(10); /* LF */
+    }
+    c = getc(infile);
+    if (c == NEWLINE_CHAR) {
+        InNewline = 1;
+        return(13); /* CR */
+    }
+    return(c);
+#endif
+}
+
+to64(infile, outfile, PortableNewlines) 
+FILE *infile, *outfile;
+int PortableNewlines;
+{
+    int c1, c2, c3, ct=0;
+    InNewline = 0; /* always reset it */
+    while ((c1 = nextcharin(infile, PortableNewlines)) != EOF) {
+        c2 = nextcharin(infile, PortableNewlines);
+        if (c2 == EOF) {
+            output64chunk(c1, 0, 0, 2, outfile);
+        } else {
+            c3 = nextcharin(infile, PortableNewlines);
+            if (c3 == EOF) {
+                output64chunk(c1, c2, 0, 1, outfile);
+            } else {
+                output64chunk(c1, c2, c3, 0, outfile);
+            }
+        }
+        ct += 4;
+        if (ct > 71) {
+            putc('\n', outfile);
+            ct = 0;
+        }
+    }
+    if (ct) putc('\n', outfile);
+    fflush(outfile);
+}
+
+output64chunk(c1, c2, c3, pads, outfile)
+FILE *outfile;
+{
+    putc(basis_64[c1>>2], outfile);
+    putc(basis_64[((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4)], outfile);
+    if (pads == 2) {
+        putc('=', outfile);
+        putc('=', outfile);
+    } else if (pads) {
+        putc(basis_64[((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6)], outfile);
+        putc('=', outfile);
+    } else {
+        putc(basis_64[((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6)], outfile);
+        putc(basis_64[c3 & 0x3F], outfile);
+    }
+}
+
+PendingBoundary(s, Boundaries, BoundaryCt)
+char *s;
+char **Boundaries;
+int *BoundaryCt;
+{
+    int i, len;
+
+    if (s[0] != '-' || s[1] != '-') return(0);
+
+
+    for (i=0; i < *BoundaryCt; ++i) {
+	len = strlen(Boundaries[i]);
+        if (!strncmp(s, Boundaries[i], len)) {
+            if (s[len] == '-' && s[len+1] == '-') *BoundaryCt = i;
+            return(1);
+        }
+    }
+    return(0);
+}
+
+/* If we're in portable newline mode, we have to convert CRLF to the 
+    local newline convention on output */
+
+static int CRpending = 0;
+
+#ifdef NEWLINE_CHAR
+almostputc(c, outfile, PortableNewlines)
+int c;
+FILE *outfile;
+int PortableNewlines;
+{
+    if (CRpending) {
+        if (c == 10) {
+            putc(NEWLINE_CHAR, outfile);
+            CRpending = 0;
+        } else {
+            putc(13, outfile);
+	    if (c != 13) {
+            	putc(c, outfile);
+		CRpending = 0;
+	    }
+        }
+    } else {
+        if (PortableNewlines && c == 13) {
+            CRpending = 1;
+        } else {
+            putc(c, outfile);
+        }
+    }
+}
+#else
+almostputc(c, outfile, PortableNewlines)
+int c;
+FILE *outfile;
+int PortableNewlines;
+{
+    putc(c, outfile);
+}
+#endif
+
+from64(infile, outfile, boundaries, boundaryct, PortableNewlines) 
+FILE *infile, *outfile;
+char **boundaries;
+int *boundaryct;
+int PortableNewlines;
+{
+    int c1, c2, c3, c4;
+    int newline = 1, DataDone = 0;
+
+    /* always reinitialize */
+    CRpending = 0;
+    while ((c1 = getc(infile)) != EOF) {
+        if (isspace(c1)) {
+            if (c1 == '\n') {
+                newline = 1;
+            } else {
+                newline = 0;
+            }
+            continue;
+        }
+        if (newline && boundaries && c1 == '-') {
+            char Buf[200];
+            /* a dash is NOT base 64, so all bets are off if NOT a boundary */
+            ungetc(c1, infile);
+            fgets(Buf, sizeof(Buf), infile);
+            if (boundaries
+                 && (Buf[0] == '-')
+                 && (Buf[1] == '-')
+                 && PendingBoundary(Buf, boundaries, boundaryct)) {
+                return;
+            }
+            fprintf(stderr, "Ignoring unrecognized boundary line: %s\n", Buf);
+            continue;
+        }
+        if (DataDone) continue;
+        newline = 0;
+        do {
+            c2 = getc(infile);
+        } while (c2 != EOF && isspace(c2));
+        do {
+            c3 = getc(infile);
+        } while (c3 != EOF && isspace(c3));
+        do {
+            c4 = getc(infile);
+        } while (c4 != EOF && isspace(c4));
+        if (c2 == EOF || c3 == EOF || c4 == EOF) {
+            fprintf(stderr, "Warning: base64 decoder saw premature EOF!\n");
+            return;
+        }
+        if (c1 == '=' || c2 == '=') {
+            DataDone=1;
+            continue;
+        }
+        c1 = char64(c1);
+        c2 = char64(c2);
+        almostputc(((c1<<2) | ((c2&0x30)>>4)), outfile, PortableNewlines);
+        if (c3 == '=') {
+            DataDone = 1;
+        } else {
+            c3 = char64(c3);
+            almostputc((((c2&0XF) << 4) | ((c3&0x3C) >> 2)), outfile, PortableNewlines);
+            if (c4 == '=') {
+                DataDone = 1;
+            } else {
+                c4 = char64(c4);
+                almostputc((((c3&0x03) <<6) | c4), outfile, PortableNewlines);
+            }
+        }
+    }
+    if (CRpending) putc(13, outfile); /* Don't drop a lone trailing char 13 */
+}
+
+static char basis_hex[] = "0123456789ABCDEF";
+static char index_hex[128] = {
+    -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
+    -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
+    -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
+     0, 1, 2, 3,  4, 5, 6, 7,  8, 9,-1,-1, -1,-1,-1,-1,
+    -1,10,11,12, 13,14,15,-1, -1,-1,-1,-1, -1,-1,-1,-1,
+    -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
+    -1,10,11,12, 13,14,15,-1, -1,-1,-1,-1, -1,-1,-1,-1,
+    -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1
+};
+
+/* The following version generated complaints on Solaris. */
+/* #define hexchar(c)  (((c) < 0 || (c) > 127) ? -1 : index_hex[(c)])  */
+/*  Since we're no longer ever calling it with anything signed, this should work: */
+#define hexchar(c)  (((c) > 127) ? -1 : index_hex[(c)])
+
+/*
+hexchar(c)
+char c;
+{
+    char *s;
+    if (islower(c)) c = toupper(c);
+    s = (char *) index(basis_hex, c);
+    if (s) return(s-basis_hex);
+    return(-1);
+}
+*/
+
+toqp(infile, outfile) 
+FILE *infile, *outfile;
+{
+    int c, ct=0, prevc=255;
+    while ((c = getc(infile)) != EOF) {
+        if ((c < 32 && (c != '\n' && c != '\t'))
+             || (c == '=')
+             || (c >= 127)
+             /* Following line is to avoid single periods alone on lines,
+               which messes up some dumb smtp implementations, sigh... */
+             || (ct == 0 && c == '.')) {
+            putc('=', outfile);
+            putc(basis_hex[c>>4], outfile);
+            putc(basis_hex[c&0xF], outfile);
+            ct += 3;
+            prevc = 'A'; /* close enough */
+        } else if (c == '\n') {
+            if (prevc == ' ' || prevc == '\t') {
+                putc('=', outfile); /* soft & hard lines */
+                putc(c, outfile);
+            }
+            putc(c, outfile);
+            ct = 0;
+            prevc = c;
+        } else {
+            if (c == 'F' && prevc == '\n') {
+                /* HORRIBLE but clever hack suggested by MTR for sendmail-avoidance */
+                c = getc(infile);
+                if (c == 'r') {
+                    c = getc(infile);
+                    if (c == 'o') {
+                        c = getc(infile);
+                        if (c == 'm') {
+                            c = getc(infile);
+                            if (c == ' ') {
+                                /* This is the case we are looking for */
+                                fputs("=46rom", outfile);
+                                ct += 6;
+                            } else {
+                                fputs("From", outfile);
+                                ct += 4;
+                            }
+                        } else {
+                            fputs("Fro", outfile);
+                            ct += 3;
+                        }
+                    } else {
+                        fputs("Fr", outfile);
+                        ct += 2;
+                    }
+                } else {
+                    putc('F', outfile);
+                    ++ct;
+                }
+                ungetc(c, infile);
+                prevc = 'x'; /* close enough -- printable */
+            } else { /* END horrible hack */
+                putc(c, outfile);
+                ++ct;
+                prevc = c;
+            }
+        }
+        if (ct > 72) {
+            putc('=', outfile);
+            putc('\n', outfile);
+            ct = 0;
+            prevc = '\n';
+        }
+    }
+    if (ct) {
+        putc('=', outfile);
+        putc('\n', outfile);
+    }
+}
+
+fromqp(infile, outfile, boundaries, boundaryct) 
+FILE *infile, *outfile;
+char **boundaries;
+int *boundaryct;
+{
+    unsigned int c1, c2;
+    int sawnewline = 1, neednewline = 0;
+    /* The neednewline hack is necessary because the newline leading into 
+      a multipart boundary is part of the boundary, not the data */
+
+    while ((c1 = getc(infile)) != EOF) {
+        if (sawnewline && boundaries && (c1 == '-')) {
+            char Buf[200];
+            unsigned char *s;
+
+            ungetc(c1, infile);
+            fgets(Buf, sizeof(Buf), infile);
+            if (boundaries
+                 && (Buf[0] == '-')
+                 && (Buf[1] == '-')
+                 && PendingBoundary(Buf, boundaries, boundaryct)) {
+                return;
+            }
+            /* Not a boundary, now we must treat THIS line as q-p, sigh */
+            if (neednewline) {
+                putc('\n', outfile);
+                neednewline = 0;
+            }
+            for (s=(unsigned char *) Buf; *s; ++s) {
+                if (*s == '=') {
+                    if (!*++s) break;
+                    if (*s == '\n') {
+                        /* ignore it */
+                        sawnewline = 1;
+                    } else {
+                        c1 = hexchar(*s);
+                        if (!*++s) break;
+                        c2 = hexchar(*s);
+                        putc(c1<<4 | c2, outfile);
+                    }
+                } else {
+#ifdef MSDOS
+                    if (*s == '\n')
+                        putc('\r', outfile);	/* insert CR for binary-mode write */
+#endif
+                    putc(*s, outfile);
+                }
+            }
+        } else {
+            if (neednewline) {
+                putc('\n', outfile);
+                neednewline = 0;
+            }
+            if (c1 == '=') {
+                sawnewline = 0;
+                c1 = getc(infile);
+                if (c1 == '\n') {
+                    /* ignore it */
+                    sawnewline = 1;
+                } else {
+                    c2 = getc(infile);
+                    c1 = hexchar(c1);
+                    c2 = hexchar(c2);
+                    putc(c1<<4 | c2, outfile);
+                    if (c2 == '\n') sawnewline = 1;
+                }
+            } else {
+                if (c1 == '\n') {
+                    sawnewline = 1;
+                    neednewline = 1;
+                } else {
+                    sawnewline = 0;
+                    putc(c1, outfile);
+                }
+            }
+        }
+    }
+    if (neednewline) {
+        putc('\n', outfile);
+        neednewline = 0;
+    }    
+}
--- metamail-2.7.orig/src/metamail/dlistold.c
+++ metamail-2.7/src/metamail/dlistold.c
@@ -0,0 +1,120 @@
+// Copyright: Michael Moerz 2000
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License with
+// the Debian GNU/Linux distribution in file /usr/share/doc/common-licenses/GPL
+// if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+// Suite 330, Boston, MA  02111-1307  USA
+
+
+#include <stdlib.h>
+#include "dlist.h"
+
+/* create a new dlist node containing data */
+DList* 
+dlist_new(void* data) {
+  DList* new = malloc( sizeof(DList) * 1 );
+  
+  new->next = NULL;
+  new->prev = NULL;
+  new->data = data;
+
+  return new;
+}
+
+/* concatenate two lists */
+void
+dlist_cat(DList* tail_l1, DList* head_l2){
+  tail_l1->next = head_l2;
+  head_l2->prev = tail_l1; 
+}
+
+/* to shorten things a bit in some cases */
+DList*
+dlist_insertnew(DList** tail, void* data) {
+  DList* new = dlist_new( data );
+  return dlist_insert( tail, new );
+}
+
+/* can also be used to append to a list */
+DList*
+dlist_insert(DList** tail, DList* new) {
+  if ( (*tail) ) {
+    new->next = (*tail)->next;
+    (*tail)->next = new;
+    new->prev = (*tail);
+  }     
+
+  if ( new->next )  // if next is defined, then set its prev value correctly
+    new->next->prev = new;
+  else
+    (*tail) = new;
+  
+  return new;
+}
+
+/* retrieves the head of a list */
+DList* 
+dlist_head(DList* head){
+  DList* old;
+
+  while( head ) {
+    old = head;
+    head = head->prev;
+  }
+  
+  return old;
+}
+
+/* retrieves the tail of a list */
+DList* 
+dlist_tail(DList* head){
+  DList* old;
+
+  while( head ) {
+    old = head;
+    head = head->next;
+  }
+  
+  return old;
+}
+
+/* returns the length of the list */
+size_t 
+dlist_length(DList* head){
+  size_t n;
+
+  for (n = 0; head; ++n)
+    head = head->next;
+
+  return n;
+}
+
+/* removes an entry from the list, and returns it so that it might
+   be destroyed properly */
+DList*
+dlist_remove(DList** head, DList** tail, DList* entry) {
+  if (entry != (*head)) {  // when not head
+    if (entry->prev)       // and a previous entry exists
+      entry->prev->next = entry->next; // tell the previous our next entry
+  } else
+    (*head) = entry->next; // otherwise next entry is head
+        
+  if (entry != (*tail)) {  // when not tail
+    if (entry->next)       // and next entry exists
+      entry->next->prev = entry->prev; // tell the next entry our previous one
+  } else
+    (*tail) = entry->prev; // otherwise previous is tail
+
+  return entry;
+}
+
--- metamail-2.7.orig/src/metamail/metamail.c
+++ metamail-2.7/src/metamail/metamail.c
@@ -0,0 +1,2223 @@
+/*
+Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
+
+Permission to use, copy, modify, and distribute this material 
+for any purpose and without fee is hereby granted, provided 
+that the above copyright notice and this permission notice 
+appear in all copies, and that the name of Bellcore not be 
+used in advertising or publicity pertaining to this 
+material without the specific, prior written permission 
+of an authorized representative of Bellcore.  BELLCORE 
+MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
+OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
+WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+*/
+/****************************************************** 
+    Metamail -- A tool to help diverse mail readers 
+                cope with diverse multimedia mail formats.
+
+    Author:  Nathaniel S. Borenstein, Bellcore
+
+ ******************************************************* */
+
+#include <metamail/common.h>
+#include <metamail/patchlevel.h>
+#include <metamail/dlist.h>
+
+#include "metamail.h"
+#include "metamail_default.h"
+#include "environment.h" /* for initializing global variables to default or
+			    environment variables and for manipulating 
+			    environment variables */
+#include "mailcap.h" /* mailcap file(s) parsing functions */
+
+
+char fileToDelete[NAME_MAX];
+
+char *FindParam();
+
+FILE *InputFP = NULL;
+
+/* mike extensions */
+int nDebug = 0;
+/* exts end */
+
+int MightAskBeforeExecuting = 1,
+    DefinitelyNotTty = 0,
+    MustNotBeTty = 0,
+    MaybePageOutput = 0,
+    MustPageOutput = 0,
+    EatLeadingNewlines = 0,
+    PrintSomeHeaders = 1,
+    DoInBackground = 0,
+    Quiet = 0,
+    TransparentMode = 0,
+    DeleteSourceFileWhenDone = 0,
+    Is822Format = 1,
+    DoDebug = 0,
+    CParamsAlloced = 0,
+    CParamsUsed = 0,
+    YankMode = 0,
+    UsingStandardInput = 0,
+    PrintingMode = 0,
+    JustWriteFiles = 0,
+    ProcessingErrors = 0;
+
+int RunAsRootOK = 0;
+
+char *ContentType = NULL,
+    *ContentEncoding = NULL,
+    *MailerName = "unknown",
+    *MailSubject = "Mail message",
+    *MailFrom = "unknown sender",
+    *MailSummary = "non-text mail message",
+    *mailheaders = NULL,
+    **CParams = NULL,
+    **CParamValues = NULL,
+    *JunkParameter = NULL;
+
+int EncodingCode = ENCODING_NONE;
+
+struct part {
+    char *ctype;
+    char *fname;
+    struct part *next;
+};
+
+struct NoAskItem *FirstNoAskItem = NULL, 
+  *FirstQuietItem = NULL;
+
+void PrintHeader();
+void ConsumeRestOfPart();
+void ParseContentParameters();
+
+sigtype cleanup();
+
+char *Cleanse(s) /* no leading or trailing space, all lower case */
+char *s;
+{
+    char *tmp, *news;
+    
+    /* strip leading white space */
+    while (*s && isspace((unsigned char) *s)) ++s;
+    news = s;
+    /* put in lower case */
+    for (tmp=s; *tmp; ++tmp) {
+        if (isupper((unsigned char) *tmp)) *tmp = 
+					     tolower((unsigned char) *tmp);
+    }
+    /* strip trailing white space */
+    while (tmp > news && *--tmp && isspace((unsigned char) *tmp)) *tmp = 0;
+    return(news);
+}
+
+char *UnquoteString(s)
+char *s;
+{
+    char *ans, *t;
+
+    if (*s != '"') return(s);
+    ans = XMALLOC(char, 1+strlen(s)); //malloc(1+strlen(s));
+    ++s;
+    t = ans;
+    while (*s) {
+        if (*s == '\\') {
+            *t++ = *++s;
+        } else if (*s == '"') {
+            break;
+        } else {
+            *t++ = *s;
+        }
+        ++s;
+    }
+    *t = 0;
+    return(ans);
+}
+
+sigtype
+cleanup(signum) 
+int signum;
+{
+    RestoreTtyState();
+    signal(signum, SIG_DFL);
+    kill(getpid(), signum);
+}
+
+char **Boundaries = NULL;
+int BoundaryCt = 0, BoundaryAlloc = 0;
+struct nextfile {
+    char *filename;
+    struct nextfile *next;
+} *FileQueue=NULL, *LastInQueue = NULL;
+
+void
+ResetGlobals() {
+    CParamsAlloced = 0;
+    CParamsUsed = 0;
+
+    ContentType = NULL;
+    ContentEncoding = NULL;
+    MailSubject = "Mail message";
+    MailFrom = "unknown sender";
+    MailSummary = "non-text mail message";
+    initMailHeadersFromEnvironment();
+    CParams = NULL;
+    CParamValues = NULL;
+    JunkParameter = NULL;
+}
+
+
+/** initializes signalhandlers to cleanup function */
+void
+initSignalHandlers() {
+    signal(SIGINT,  cleanup);
+    signal(SIGILL,  cleanup);
+    signal(SIGTRAP, cleanup);
+    signal(SIGIOT,  cleanup);
+    signal(SIGFPE,  cleanup);
+    signal(SIGSEGV, cleanup);
+    signal(SIGTERM, cleanup);
+#ifdef SIGXCPU
+    signal(SIGXCPU, cleanup);
+#endif
+}
+
+/** the main function for metamail */
+main(argc, argv)
+int argc;
+char **argv;
+{
+    int retcode = 0;
+
+    initSignalHandlers;
+    addToPath(AUXPATH);           /* add additional dirs to PATH */
+    fileToDelete[0] = 0;
+
+    ProcessArguments(argc, argv); /* calls ExitWithError on error */
+
+    if (MaybePageOutput) {
+        /* Want to send stderr to pager too, sigh... */
+        fflush(stderr);
+        close(2);
+        dup2(1, 2);
+    }
+
+    retcode = HandleMessage(NULL, 0);
+    if (! UsingStandardInput) {
+        fclose(InputFP);
+    }
+    if (fileToDelete[0]) {
+        RmTmpFileName(fileToDelete);
+        fileToDelete[0] = 0;
+    }
+
+    while (FileQueue) {
+        InputFP = fopen(FileQueue->filename, "r");
+        if (DoDebug) printf("Trying to open input file: %s\n",
+			    FileQueue->filename);
+        if (!InputFP) ExitWithError("Can't read input file");
+        if (DeleteSourceFileWhenDone) {
+            strcpy(fileToDelete, FileQueue->filename);
+        }
+        ResetGlobals();
+        retcode |= HandleMessage(NULL, 0);
+        if (! UsingStandardInput) {
+            fclose(InputFP);
+        }
+        if (fileToDelete[0]) {
+            RmTmpFileName(fileToDelete);
+            fileToDelete[0] = 0;
+        }
+        FileQueue = FileQueue->next;
+    }
+    if (MustPageOutput) PauseForUser();
+    if (DoDebug) fprintf(stderr, "end of metamail\n");
+    CleanupTmpFiles();
+    exit(ProcessingErrors? -1 : retcode);
+}
+
+void
+QueueNextFile(fname)
+char *fname;
+{
+    struct nextfile *tmp = XMALLOC( struct nextfile, 1);
+    tmp->filename = fname;
+    tmp->next = NULL;
+    if (FileQueue) {
+        LastInQueue->next = tmp;
+        LastInQueue = tmp;
+    } else {
+        FileQueue = tmp;
+        LastInQueue = tmp;
+    }
+}
+
+HandleMessage(SquirrelFile, nestingdepth)
+char *SquirrelFile;
+/* SquirrelFile, if non-NULL, is a place to save a recognized body instead of executing it. */
+int nestingdepth;
+{
+    char *boundary;
+    int FileWriteOnly = JustWriteFiles;
+
+    if (FileWriteOnly) {
+        if (!lc2strncmp(ContentType, "message/", 8)
+             || !lc2strncmp(ContentType, "multipart/", 10)) {
+            FileWriteOnly = 0; /* only leaf data */
+        }
+    }
+    if (Is822Format) {
+	if (Read822Prefix(SquirrelFile?0:1, nestingdepth)) {
+	    return -1;
+	}
+    } else /* this property is not recursive for multipart or message */
+      Is822Format = 1;
+
+    PrepareMessage();
+    if (!FileWriteOnly && !ProcessMailcapFiles(SquirrelFile)) return(0);
+	
+    if (!lc2strcmp(ContentType, "message")
+         || !lc2strcmp(ContentType, "message/rfc822")) { 
+        if (SquirrelFile) return(SaveSquirrelFile(SquirrelFile));
+        ContentType = NULL; /* reset default */
+        ContentEncoding = NULL; /* reset default */
+        return(HandleMessage(NULL, nestingdepth+1)); /* simple recursion */
+    }
+
+    boundary = FindParam("boundary");
+    if (!boundary) boundary =JunkParameter; /* backward compatibility hack */
+    if (!lc2strncmp(ContentType, "multipart", 9)) { 
+      if (!boundary) {
+	  fprintf(stderr, "Warning: No boundary for multipart data, treating as unrecognized format.\n");
+      } else {
+        char *LineBuf, NewSquirrelFile[TMPNAME_MAX];
+        char *subtype = NULL;
+        int currct, result, IsAlternative, WroteSquirrelFile, boundarylen;
+
+        if (SquirrelFile) return(SaveSquirrelFile(SquirrelFile));
+        if (boundary[0] == '"') {
+            boundary=UnquoteString(boundary);
+        }
+        subtype = index(ContentType, '/');
+        if (subtype) {
+            ++subtype;
+            subtype = Cleanse(subtype);
+        } else subtype = "mixed";
+
+        if (!MaybePageOutput && !DoInBackground) 
+	  DoInBackground = strcmp(subtype, "parallel") ? 0 : 1;
+
+        IsAlternative = strcmp(subtype, "alternative") ? 0 : 1;
+        if (IsAlternative) {
+            MkTmpFileName(NewSquirrelFile);
+            WroteSquirrelFile = 0;
+        }
+        LineBuf = XMALLOC(char, LINE_BUF_SIZE);
+        sprintf(LineBuf, "--%s", boundary);
+        strcpy(boundary, LineBuf);
+        boundarylen = strlen(boundary);
+        if (BoundaryCt >= BoundaryAlloc) {
+            BoundaryAlloc += 5;
+            if (Boundaries) 
+	        Boundaries = XREALLOC(char *, Boundaries, BoundaryAlloc);
+            else 
+	        Boundaries = XMALLOC(char *, BoundaryAlloc);
+        }
+        Boundaries[BoundaryCt++] = boundary;
+        if (DoDebug) printf("Handling multipart as built-in here.  Boundary: %s\n", boundary);
+        while (fgets(LineBuf, LINE_BUF_SIZE, InputFP)) { /* find start */
+            if (!strncmp(LineBuf, boundary, boundarylen)
+                 && ((LineBuf[boundarylen] == '\n')
+                      || (LineBuf[boundarylen] == '-'
+                           && LineBuf[boundarylen+1] == '-'
+                           && LineBuf[boundarylen+2] == '\n'))) {
+                break;
+            }
+        }
+        XFREE(LineBuf);
+        currct = BoundaryCt;
+        while(currct == BoundaryCt) {
+            if (!strcmp(subtype, "digest")) {
+                ContentType = "message/rfc822";
+            } else {
+                ContentType = NULL; /* reset default */
+            }
+            ContentEncoding = NULL; /* reset default */
+            if (IsAlternative) {
+                result = HandleMessage(NewSquirrelFile, nestingdepth+1);
+            } else{
+                result = HandleMessage(NULL, nestingdepth+1);
+            }
+            if (result) {
+                /* Need to consume the rest of the part */
+                ConsumeRestOfPart(NULL);
+            } else {
+                ++WroteSquirrelFile;
+            }
+        }
+        /* Now we've seen the last encapsulation boundary, but if there is a "postfix"
+            we must throw it away.*/
+        if (BoundaryCt > 0) {
+            ConsumeRestOfPart(NULL);
+        }
+        if (IsAlternative) {
+            if (WroteSquirrelFile) {
+                int retcode; 
+                char Cmd[TMPNAME_MAX + 15];
+                sprintf(Cmd, "%s %s", METAMAIL, NewSquirrelFile);
+                fflush(stdout); fflush(stderr);
+                retcode = system(Cmd);
+                RmTmpFileName(NewSquirrelFile);
+                return(retcode);
+            } else {
+                printf("Cannot handle any part of multipart/alternative message\n");
+            }
+        }
+	return(0);
+      }
+    } /* End of multipart handling */
+    if (!FileWriteOnly && !TryBuiltIns(SquirrelFile)) return(0);
+    if (!SquirrelFile) { /* Very last resort -- unrecognized types */
+        char Fname[NAME_MAX], *suggestedname, SugBuf[NAME_MAX];
+        FILE *fp;
+        int ans = 0, octetstream, ecode=0;
+        int JustMadeTheFile=0;
+
+        Fname[0] = 0;
+
+        suggestedname = FindParam("name");
+        if (!suggestedname) {
+            MkTmpFileName(SugBuf);
+            suggestedname = SugBuf;
+            JustMadeTheFile=1;
+        }
+        if (strlen(suggestedname) > NAME_MAX - 50)
+             suggestedname[NAME_MAX - 50] = '\0';
+        if (suggestedname[0] == '"')
+                suggestedname=UnquoteString(suggestedname);
+ 
+        octetstream = ! lc2strcmp(ContentType, "application/octet-stream");
+        if (MightAskBeforeExecuting && !DefinitelyNotTty && !MustNotBeTty) {
+            if (FileWriteOnly) {
+                printf("\nThis message contains '%s`-format data.\n", ContentType);
+            } else if (octetstream) {
+                printf("This message contains raw digital data, which can either be viewed as text\nor written to a file.\n");
+            } else {
+                printf("\nThis message contains data in an unrecognized format, %s,\nwhich can either be viewed as text or written to a file.\n", ContentType);
+            }
+            while (!ans) {
+                if (FileWriteOnly) {
+                    ans = 2;
+                } else {
+                    printf("\nWhat do you want to do with the %s data?\n1 -- See it as text\n2 -- Write it to a file\n3 -- Just skip it\n4 -- Give another content type\n\n", octetstream ? "raw" : ContentType);
+                    fgets(Fname, sizeof(Fname), stdin);
+                    ans = atoi(Fname);
+                }
+                switch(ans) {
+                    case 1:
+                        TranslateInputToOutput(InputFP, stdout, EncodingCode, "text");
+                        return(0);
+                    case 2:
+                        {
+                        int needname = 1;
+                        while (needname) {
+                            needname = 0;
+                            printf("Please enter the name of a file to which the data should be written\n(Default: %s) > ", suggestedname);
+                            fflush(stdout);
+                            fgets(Fname, sizeof(Fname), stdin);
+                            Fname[strlen(Fname) - 1] = '\0'; /* bogus newline */
+                            if (!Fname[0])
+			      strcpy(Fname, suggestedname);
+
+                            if (Fname[0] == '~' && Fname[1] == '/') {
+                                char Fname2[NAME_MAX];
+                                int uid = getuid();
+                                struct passwd *p;
+                                p = getpwuid(uid);
+                                if (!p) {
+				  strcpy( Fname, suggestedname );
+				  printf("Cannot figure out what ~ means, using temporary file %s instead\n", Fname);
+                                } else {
+                                    strcpy(Fname2, p->pw_dir);
+                                    strcat(Fname2, "/");
+                                    strcat(Fname2, Fname + 2);
+                                    strcpy(Fname, Fname2);
+                                }
+                            }
+
+			    if ( strcmp( Fname, suggestedname ) ) 
+			      RmTmpFileName( suggestedname );
+			    else  /* remove from tmp list (should persist) */
+			      DelTmpFileName( suggestedname ); 
+			    
+			    
+			    if (DoDebug) fprintf(stderr, "pre access");
+
+                            if (!JustMadeTheFile && access(Fname, F_OK) == 0) {
+                                char *s, AnsBuf[50];
+                                int overwriteans = -1;
+                                do {
+                                    printf("File %s exists.  Do you want to overwrite it (y/n) ?\n", Fname);
+                                    s = fgets(AnsBuf, sizeof(AnsBuf), stdin);
+                                    if (!s) {
+                                        overwriteans = 0;
+                                    } else {
+                                        while (s && *s && isspace((unsigned char) *s)) ++s;
+                                        if (*s == 'y' || *s == 'Y' || !*s || *s == '\n') {
+                                            overwriteans = 1;
+                                        } else if (*s == 'n' || *s == 'N' || *s == 'q' || *s == 'Q') {
+                                            overwriteans=0;
+                                        }
+                                    }
+                                    if (overwriteans == -1) printf("Please answer yes or no.\n");
+                                } while (overwriteans == -1);
+                                if (overwriteans == 0) needname = 1;
+                            }
+                        }
+                        }
+                        break;
+                    case 3:
+                        ConsumeRestOfPart(NULL);
+                        return(0);
+                        break;
+		    case 4:
+		      {
+			char *savedContentType = ContentType;
+			ContentType = malloc(64);
+			printf("Please enter new content type> ");
+			fflush(stdout);
+			fgets(ContentType, 64, stdin);
+			ContentType[strlen(ContentType) - 1] = '\0'; /* bogus newline */
+			if (!ProcessMailcapFiles(SquirrelFile)) { 
+			  free(savedContentType); 
+			  return(0); 
+			}
+			printf("\nNo matching mailcap entry found.\n");
+			free(ContentType);
+			ContentType = savedContentType;
+			ans = 0;
+			break;
+		      }
+                    default:
+                        ans = 0;
+                        break;
+                }
+            }
+        } else {
+            int ct = 0;
+            char *slash = rindex(suggestedname, '/');
+            if (slash)  {
+                ++slash;
+            } else {
+                slash = suggestedname;
+            }
+            do {
+                if (ct) {
+                    sprintf(Fname, "%s/%d-%s", tmproot, ct, slash);
+                } else {
+                    sprintf(Fname, "%s/%s", tmproot, slash);
+                }
+                ++ct;
+            } while (access(Fname, F_OK) == 0);
+            if (FileWriteOnly) {
+                printf("\nThis message contains '%s`-format data.\n", ContentType);
+            } else if (octetstream) {
+                printf("\nThis message contains raw digital data,");
+            } else {
+                printf("\nThis message contains data in an unrecognized format, %s,", ContentType);
+            }
+            printf("\nwhich is being decoded and written to the file named \"%s\".\nIf you do not want this data, you probably should delete that file.\n", Fname);
+        }
+        if (Fname[0] == 0 || Fname[0] == '\n') {
+            ConsumeRestOfPart(NULL);
+        } else {
+            fp = fopen(Fname, WRITE_BINARY);
+            if (!fp) ExitWithError("Cannot open temporary file");
+            TranslateInputToOutput(InputFP, fp, EncodingCode, ContentType);
+            ecode = fclose(fp);
+            if (ecode) {
+                printf("Could not write file %s\n", Fname);
+            } else {
+                printf("Wrote file %s\n", Fname);
+            }
+        }
+        if (!DefinitelyNotTty && MaybePageOutput && BoundaryCt > 0) PauseForUser();
+        return(ecode);
+    }
+    return(-1); /* Unrecognized, really */
+}
+
+ProcessArguments(argc, argv)
+int argc;
+char **argv;
+{
+  int i;
+  char *SourceFileName = NULL;
+
+  initVarsFromEnvironment(); /* init global vars from environment */
+
+    for (i=1; i<argc; ++i) {
+	if (argv[i][0] == '-') {
+	    switch (argv[i][1]) {
+		case '\0':
+		    /* Not really necessary, but.... */
+		    SourceFileName = NULL;
+		    UsingStandardInput = 1;
+		    break;
+		case 'b':
+		    Is822Format = 0;
+		    break;
+		case 'B':
+		    DoInBackground = 1;
+		    break;
+                case 'c':
+		    if (++i >= argc) usage();
+		    ContentType = XMALLOC(char, 1+strlen(argv[i]));
+                    strcpy(ContentType,argv[i]);
+                    /* strip leading white space */
+                    while (*ContentType && isspace((unsigned char) *ContentType)) ++ContentType;
+                    StripTrailingSpace(ContentType);
+                    ParseContentParameters(ContentType);
+                    break;
+                case 'd':
+		    MightAskBeforeExecuting = 0;
+		    break;
+		case 'e':
+		    EatLeadingNewlines = 1;
+		    break;
+		case 'E':
+		    if (++i >= argc) usage();
+		    ContentEncoding = argv[i];
+		    break;
+		case 'f':
+		    if (++i >= argc) usage();
+		    MailFrom = argv[i];
+                    break;
+                case 'h':
+                    {
+                    FILE *tmpfp;
+                    PrintingMode = 1;
+                    MightAskBeforeExecuting = 0;
+		    //#ifdef AMIGA
+		    //		    freopen("prt:", "w", stdout);
+		    //#else
+                    /* Want to make all of stdout go to printer, and this 
+                      is easier than changing every output statement,
+                      at least on UNIX... */
+                    tmpfp = popen(LPRCOMMAND, "w");
+                    if (!tmpfp) {
+                        ExitWithError("Cannot execute lpr command");
+                    }
+                    fflush(stdout);
+                    close(1);
+                    dup2(fileno(tmpfp), 1);
+		    //#endif
+                    break;
+                    }
+		case 'm':
+		    if (++i >= argc) usage();
+		    MailerName = argv[i];
+		    break;
+		case 'p':
+		    MaybePageOutput = 1;
+		    break;
+		case 'P':
+                    MaybePageOutput = 1;
+                    MustPageOutput = 1;
+		    break;
+		case 'r':
+		    RunAsRootOK = 1;
+                    break;
+                case 'R':
+#ifdef RESET_PROGRAM
+                    system(RESET_PROGRAM);
+                    if (DoDebug) printf("Executed reset\n");
+#else
+                    fprintf(stderr, "metamail warning: -R flag not supported on this system\n");
+#endif
+                    break;
+		case 's':
+		    if (++i >= argc) usage();
+		    MailSubject = argv[i];
+		    break;
+                case 'T':
+                    TransparentMode = 0;
+                    break;
+                case 'w':
+                    JustWriteFiles = 1;
+                    break;
+                case 'q':
+                    Quiet = 1;
+		    PrintSomeHeaders = 0;
+		    break;
+		case 'x':
+                    DefinitelyNotTty = 1;
+                    MustNotBeTty = 1;
+		    break;
+                case 'y':
+                    YankMode = 1;
+                    break;
+		case 'z':
+		    DeleteSourceFileWhenDone = 1;
+		    break;
+		default:
+		    usage();
+	    }
+	} else {
+	    if (SourceFileName) {
+                QueueNextFile(argv[i]);
+	    } else {
+		SourceFileName = argv[i];
+	    }
+	}
+    }
+    if (TransparentMode) {
+        RunInNewWindow(argv, argc, &SourceFileName);
+    }
+    if (MaybePageOutput && DoInBackground) {
+	MustNotBeTty = 1;
+        /*fprintf(stderr, "metamail: -B is incompatible with -p, -P, and MM_USEPAGER\n");
+        usage(); */
+    }
+    if (!Is822Format && !ContentType) {
+	fprintf(stderr, "metamail:  -b requires -c.\n");
+	usage();
+    }
+    if (DeleteSourceFileWhenDone && !SourceFileName) {
+	fprintf(stderr, "metamail:  -z requires -f.\n");
+	usage();
+    }
+    if (!RunAsRootOK && (getuid() == 0 || geteuid() == 0)) {
+	fprintf(stderr, "You can not run MetaMail as root unless you use -r or set MM_RUNASROOT.\n");
+	usage();
+    }
+    if (SourceFileName) {
+        InputFP = fopen(SourceFileName, "r");
+        if (DoDebug) printf("Trying to open input file: %s\n", SourceFileName);
+        if (!InputFP) ExitWithError("Can't read input file");
+        if (DeleteSourceFileWhenDone) {
+            strcpy(fileToDelete, SourceFileName);
+        }
+    } else {  /* input on stdin */
+        UsingStandardInput = 1;
+        if (MustNotBeTty) {
+            InputFP = stdin;
+/*            MaybePageOutput = 1; */ /* This messed up safe-tcl -- nsb 9/21/93 */
+            MightAskBeforeExecuting = 0;
+        } else {
+            int newfd = dup(0);
+            FILE *newfp;
+            if (newfd > 0) {
+                InputFP = fdopen(newfd, "r");
+                if (InputFP 
+                     && ((newfp = fopen("/dev/tty", "r")) != NULL)
+                     && !dup2(fileno(newfp), 0)) {
+                    DefinitelyNotTty = 0;
+                } else {
+                    InputFP = stdin;
+                    DefinitelyNotTty = 1;
+                    MaybePageOutput = 0;
+                }
+            }
+        }
+    }
+    if (DefinitelyNotTty && MaybePageOutput) {
+        RunInNewWindow(argv, argc, &SourceFileName);
+    }
+    if (DefinitelyNotTty) {
+        MaybePageOutput = 0;	/* Disable pager if I/O has been redirected */
+    }
+    return(0);
+}
+
+usage() {
+    fprintf(stderr, "Usage:  metamail [-b] [-B] [-d] [-e] [-h] [-r] [-R] [-p]  [-P] [-x] [-y] [-z] [-c content-type] [-E content-transfer-encoding] [-f from-name] [-m mailername] [-s subject] [message-file-name]\n");
+    ExitWithError(NULL);
+}
+
+RunInNewWindow(argv, argc, SourceFileNamePtr)
+char **argv, **SourceFileNamePtr;
+int argc;
+{
+    char *FullCmd, TmpName[TMPNAME_MAX];
+    int i, createdfile=0;
+    if (!*SourceFileNamePtr) {
+        char *LineBuf;
+        FILE *fptmp;
+
+        LineBuf = XMALLOC(char, LINE_BUF_SIZE);
+        /* Create it, ugh.  Also needs to affect later command. */
+        MkTmpFileName(TmpName);
+	DelTmpFileName(TmpName);
+        DeleteSourceFileWhenDone = 1;
+        fptmp = fopen(TmpName, WRITE_BINARY);
+        if (!fptmp) ExitWithError("Can't open temporary file\n");
+        while (fgets(LineBuf, LINE_BUF_SIZE, stdin)) {
+            fputs(LineBuf, fptmp);
+        }
+        XFREE(LineBuf);
+        fclose(fptmp);
+        *SourceFileNamePtr = TmpName;
+        createdfile = 1;
+    }
+    FullCmd = XMALLOC(char, CMDSIZE);
+    if (TransparentMode) {
+        /* In transparent mode, we want to produce stdout that is what we get in, and do EVERYTHING externally in a terminal window.  This is to make the truly brain-dead mailers like mailtool happy. I am NOT happy about having to do this.  */
+        /* So, first we copy everything to stdout */
+        sprintf(FullCmd, CATTEMPLATE, *SourceFileNamePtr);
+        system(FullCmd); /* Cheesy way to do it */
+        fflush(stdout); fflush(stderr);
+    }
+    /* Then we run ourselves in a terminal window */
+    MailSummary = "Metamail"; /* for window label */
+    CreateNewWindowPrefix(FullCmd);
+    strcat(FullCmd, METAMAIL);
+    strcat(FullCmd, " -P ");
+    if (TransparentMode) strcat(FullCmd, "-T ");
+    for (i=1; i<argc; ++i) {
+        if (strncmp(argv[i], "-x", 2)
+             && strncmp(argv[i], "-B", 2)
+             && strncmp(argv[i], "-d", 2)) {
+            strcat(FullCmd, "\"");
+            strcat(FullCmd, argv[i]);
+            strcat(FullCmd, "\" ");
+        }
+    }
+    if (createdfile) {
+        strcat(FullCmd, "-z ");
+        strcat(FullCmd, *SourceFileNamePtr);
+    }
+    if (!MightAskBeforeExecuting) {
+        strcat(FullCmd, " -d ");
+        /* The special hack for -d is HORRIBLE, but xterm screws up with the -d option in the middle of the command line! */
+    }
+    if (DoInBackground) strcat(FullCmd, " &");
+    DefinitelyNotTty = 0;
+    SetUpEnvironment();
+    if (DoDebug) fprintf(stderr, "Executing %s\n", FullCmd);
+    fflush(stdout); fflush(stderr);
+    exit(system(FullCmd));
+}
+
+
+static char *ThingsToSkip[] = {
+    "csh ",
+    "sh ",
+    "ksh ",
+    NULL
+};
+
+char *ShortCommand(progname)
+char *progname;
+{
+    int i;
+    char *s, *oldprogname;
+    static char FullProgName[500];
+
+eatmore:
+    while (*progname && (*progname == '(' || isspace((unsigned char) *progname))) {
+        ++progname;
+    }
+    oldprogname = progname;
+    for (i = 0; oldprogname == progname && ThingsToSkip[i]; ++i) {
+        if (!strncmp(progname, ThingsToSkip[i], strlen(ThingsToSkip[i]))) {
+            progname += strlen(ThingsToSkip[i]);
+        }
+    }
+    if (*progname == '-') {
+        ++progname;
+        while (*progname && !isspace((unsigned char) *progname)) ++progname;
+    }
+    if (progname != oldprogname) goto eatmore;
+    strcpy(FullProgName, progname);
+    s = index(FullProgName, ' ');
+    if (s) *s = 0;
+    s = rindex(FullProgName, '/');
+    if (s) {
+	return(s+1);
+    } else {
+	return(FullProgName);
+    }
+}    
+
+TryMailcapEntry(mc, SquirrelFile)
+struct MailcapEntry mc;
+char *SquirrelFile;
+{
+    StripTrailingSpace(mc.contenttype);
+    if (DoDebug) fprintf(stderr, "Trying mailcap entry for '%s'.\n", mc.contenttype);
+    if (PrintingMode && !mc.printcommand) return(-1);
+    if (CtypeMatch(ContentType, mc.contenttype) && PassesTest(&mc)) {
+        if (SquirrelFile) {
+            return(SaveSquirrelFile(SquirrelFile));
+        } else {
+            char TmpFileName[TMPNAME_MAX];
+            MkTmpFileName(TmpFileName);
+            return(ExecuteMailcapEntry(mc, TmpFileName, ContentType));
+        }
+    }
+    if (mc.needtofree) {
+        XFREE(mc.contenttype);
+        XFREE(mc.command);
+    }
+    return(-1);
+}
+
+SaveSquirrelFile(SquirrelFile)
+char *SquirrelFile;
+{
+    int j;
+    FILE *outfp;
+
+    if (DoDebug) printf("saving to file %s\n", SquirrelFile);
+
+    outfp = fopen(SquirrelFile, WRITE_BINARY);
+    if (!outfp) {
+        fprintf(stderr, "Cannot open %s to squirrel away a portion of a multipart/alternative\n", SquirrelFile);
+        return(-1);
+    }
+    fprintf(outfp, "Content-type: %s", ContentType);
+    for (j=0; j<CParamsUsed; ++j) {
+        fprintf(outfp, " ; ");
+        fprintf(outfp, "%s", CParams[j]);
+        fprintf(outfp, " = ");
+        fprintf(outfp, "%s", CParamValues[j]);
+    }
+    fprintf(outfp, "\n\n"); 
+    TranslateInputToOutput(InputFP, outfp, EncodingCode, ContentType);
+    if (fclose(outfp)) {
+        ExitWithError("fclose failed");
+    }
+    return(0);
+}
+
+ExecuteMailcapEntry(mc, TmpFileName, ThisContentType)
+char *TmpFileName, *ThisContentType;
+struct MailcapEntry mc;
+{
+    int resultcode=0, DidExecute, UsedTmpFileName;
+    struct part *PartsWritten=NULL;
+    char *s, *cmd;
+
+    cmd = XMALLOC(char, CMDSIZE);
+    if (PrintingMode && !mc.printcommand) return(-1);
+    BuildCommand(cmd, PrintingMode ? mc.printcommand : mc.command, TmpFileName, &UsedTmpFileName, &PartsWritten);
+    if (DoDebug) fprintf(stderr, "Match!  Built command %s.\n", cmd);
+    if (mc.copiousoutput && MaybePageOutput) {
+        strcat(cmd, " | ");
+        s = getenv("METAMAIL_PAGER");
+        if (s && strncmp(s, "metamail", 8)) {
+            /* If METAMAIL_PAGER is set to "metamail" we override it */
+            strcat(cmd, s);
+            if (!strncmp(s, "less", 4) && strncmp(s+5, "-r", 2)) {
+                fprintf(stderr, "Warning:  'less' without '-r' behaves badly for some mail types,\n\tnotably richtext.\n");
+            }
+        } else {
+            strcat(cmd, "more");
+        }
+    }
+    if (!DefinitelyNotTty) {
+        SaveTtyState();
+    }
+    if (!NeedToAskBeforeExecuting(ThisContentType)
+         || OKToRun(ThisContentType, cmd, mc.label)) {
+        char *FullCmd;
+        int ReallyNotTty;
+	//#ifndef NO_RLIMITS
+        /* Limit size of core dumps */
+        //struct rlimit rlp;
+
+        //rlp.rlim_cur = 0;
+        //rlp.rlim_max = 0;
+        //setrlimit(RLIMIT_CORE, &rlp); 
+	//#endif
+        FullCmd = XMALLOC(char, CMDSIZE);
+        ReallyNotTty = DefinitelyNotTty;
+        if (mc.needsterminal
+             && DefinitelyNotTty) {
+            int j;
+            sprintf(cmd, " %s -P -b -c '%s", METAMAIL, ThisContentType);
+            for (j=0; j<CParamsUsed; ++j) {
+                strcat(cmd, " ; ");
+                strcatquoting(cmd, CParams[j]);
+                strcat(cmd, " = ");
+                strcatquoting(cmd, CParamValues[j]);
+            }
+            strcat(cmd, "' ");
+            strcat(cmd, TmpFileName);
+            CreateNewWindowPrefix(FullCmd);
+            strcat(FullCmd, cmd);
+            DefinitelyNotTty = 0; /* For recursive call */
+        } else {
+            strcpy(FullCmd, cmd);
+        }
+        DidExecute = 0;
+        if (UsedTmpFileName || PartsWritten) {
+            int isempty;
+            if (PartsWritten) {
+                isempty = 0;
+            } else {
+                isempty = WriteTmpFile(TmpFileName, ThisContentType);
+            }
+            if (!isempty || strncmp(ThisContentType, "text", 4)) {
+                if (DoInBackground && !PartsWritten && !mc.needsterminal) {
+                    char TmpCmd[CMDSIZE];
+                    sprintf(TmpCmd, "(%s; rm %s) &", FullCmd, TmpFileName);
+                    DefinitelyNotTty = 1; /* in background */
+                    SetUpEnvironment();
+                    resultcode = ExecuteCommand(TmpCmd, 1);
+		    DelTmpFileName(TmpFileName); /* an rm ... was already added
+						    to the executing cmd */
+                    ++DidExecute;
+                } else {
+                    SetUpEnvironment();
+                    resultcode = ExecuteCommand(FullCmd, 1);
+                    RmTmpFileName(TmpFileName);
+                    ++DidExecute;
+                }
+            } else { /* empty text part, hack to not say "more" */
+                RmTmpFileName(TmpFileName);
+            }
+        } else {
+            FILE *tmpfp;
+            SetUpEnvironment();
+            (void) ExecuteCommand(FullCmd, 0);
+            tmpfp = popen(FullCmd, WRITE_BINARY);
+            TranslateInputToOutput(InputFP, tmpfp, EncodingCode, ThisContentType);
+            resultcode = tmpfp ? pclose(tmpfp) : -1;
+            ++DidExecute;
+        }
+        DefinitelyNotTty = ReallyNotTty;
+        if (!DefinitelyNotTty && DidExecute) {
+            RestoreTtyState();
+            if (mc.copiousoutput && MaybePageOutput && BoundaryCt > 0) PauseForUser();
+        }
+        if (!resultcode) {
+            XFREE(FullCmd);
+        } else {
+            fprintf(stderr, "Command failed: %s\n", FullCmd);
+            if (MaybePageOutput && BoundaryCt > 0) PauseForUser();
+            ++ProcessingErrors;
+        }
+    } else {
+        /* user does not want to execute command */
+        if (!DefinitelyNotTty) {
+            RestoreTtyState();
+        }
+        if (DoDebug) fprintf(stderr, "Not executing command.\n");
+        if (!PartsWritten) ConsumeRestOfPart(NULL);
+    }
+    if (PartsWritten) {
+        struct part *tp;
+        char HeadFile[NAME_MAX];
+
+        while (PartsWritten) {
+            tp=PartsWritten->next;
+            XFREE(PartsWritten->ctype);
+            strcpy(HeadFile, PartsWritten->fname);
+            strcat(HeadFile, "H");
+            RmTmpFileName(HeadFile);
+            RmTmpFileName(PartsWritten->fname);
+            XFREE(PartsWritten->fname);
+            XFREE(PartsWritten);
+            PartsWritten=tp;
+        }
+    }
+    if (!DefinitelyNotTty) {
+        RestoreTtyState();
+    }
+    XFREE(cmd);
+    return(0);
+}
+
+PassesTest(mc)
+struct MailcapEntry *mc;
+{
+    int result;
+    char *cmd, TmpFileName[TMPNAME_MAX];
+
+    if (!mc->testcommand) return(1);
+    MkTmpFileName(TmpFileName);
+    cmd = XMALLOC(char, CMDSIZE);
+    BuildCommand(cmd, mc->testcommand, TmpFileName, NULL, NULL);
+    if (DoDebug) printf("Executing test command: %s\n", cmd);
+    result = system(cmd);
+    XFREE(cmd);
+    return(!result);
+}
+
+char *
+GetCommand(s, t)
+char *s, **t;
+{
+    char *s2;
+    int quoted = 0;
+    s2 = XMALLOC(char, strlen(s)*2+1); /* absolute max, if all % signs */
+    *t = s2;
+    while (s && *s) {
+	if (quoted) {
+            if (*s == '%') *s2++ = '%'; /* Quote through next level, ugh! */
+
+            *s2++ = *s++;
+	    quoted = 0;
+	} else {
+	    if (*s == ';') {
+                *s2 = 0;
+		return(++s);
+	    }
+	    if (*s == '\\') {
+		quoted = 1;
+		++s;
+	    } else {
+		*s2++ = *s++;
+	    }
+	}
+    }
+    *s2 = 0;
+    return(NULL);
+}	
+
+GetMailcapEntry(fp, mc)
+FILE *fp;
+struct MailcapEntry *mc;
+{
+    int rawentryalloc = 2000, len;
+    char *rawentry, *s, *t, *LineBuf;
+
+    LineBuf = XMALLOC(char, LINE_BUF_SIZE);
+    rawentry = XMALLOC(char, 1 + rawentryalloc);
+    *rawentry = 0;
+    while (fgets(LineBuf, LINE_BUF_SIZE, fp)) {
+	if (LineBuf[0] == '#') continue;
+        len = strlen(LineBuf);
+        if (len == 0) continue;
+        if (LineBuf[len-1] == '\n') LineBuf[--len] = 0;
+	if ((len + strlen(rawentry)) > rawentryalloc) {
+	    rawentryalloc += 2000;
+	    rawentry = realloc(rawentry, rawentryalloc+1);
+	}
+	if (LineBuf[len-1] == '\\') {
+            LineBuf[len-1] = 0;
+	    strcat(rawentry, LineBuf);
+	} else {
+	    strcat(rawentry, LineBuf);
+	    break;
+	}
+    }
+    XFREE(LineBuf);
+    for (s=rawentry; *s && isspace((unsigned char) *s); ++s) ;
+    if (!*s) {
+	/* totally blank entry -- quietly ignore */
+	XFREE(rawentry);
+	return(0);
+    }
+    s = index(rawentry, ';');
+    if (!s) {
+	fprintf(stderr, "metamail: Ignoring invalid mailcap entry: %s\n", rawentry);
+	XFREE(rawentry);
+	return(0);
+    }
+    *s++ = 0;
+    mc->needsterminal = 0;
+    mc->copiousoutput = 0;
+    mc->needtofree = 1;
+    mc->testcommand = NULL;
+    mc->label = NULL;
+    mc->printcommand = NULL;
+    mc->contenttype = XMALLOC(char, 1+strlen(rawentry));
+    strcpy(mc->contenttype, rawentry);
+    t = GetCommand(s, &mc->command);
+    if (!t) {
+        XFREE(rawentry);
+        return(1);
+    }
+    while (s && *s && isspace((unsigned char) *s)) ++s;
+    s = t;
+    while (s) {
+	char *arg, *eq;
+
+        t = GetCommand(s, &arg);
+/*        if (t) *t++ = 0; */
+        eq = index(arg, '=');
+        if (eq) *eq++ = 0;
+	if (*arg) {
+	    arg = Cleanse(arg);
+	    if (!strcmp(arg, "needsterminal")) {
+		mc->needsterminal = 1;
+	    } else if (!strcmp(arg, "copiousoutput")) {
+		mc->copiousoutput = 1;
+	    } else if (eq && !strcmp(arg, "test")) {
+		mc->testcommand = eq;
+	    } else if (eq && !strcmp(arg, "description")) {
+		mc->label = eq;
+	    } else if (eq && !strcmp(arg, "label")) { 
+		mc->label = eq; /* bogus old name for description */
+	    } else if (eq && !strcmp(arg, "print")) {
+		mc->printcommand = eq;
+	    } else if (eq && !strcmp(arg, "textualnewlines")) {
+		ExceptionalNewline(mc->contenttype, atoi(eq));
+	    } else if (strcmp(arg, "notes")) { /* IGNORE notes field */
+		if (*arg && DoDebug) fprintf(stderr, "metamail: Ignoring mailcap flag: %s\n", arg);
+	    }
+	}
+	s = t;
+    }
+    XFREE(rawentry);
+    return(1);
+}
+
+ExitWithError(txt)
+char *txt;
+{
+    if (txt) fprintf(stderr, "metamail: %s\n", txt);
+    exit(-1);
+}
+
+char *
+FreshHeaderCopy(s)
+char *s;
+{
+    char *t, *newcopy;
+    int len;
+
+    while (s && *s && isspace((unsigned char) *s) && *s != '\n') ++s;
+    t = index(s, '\n');
+    while (t && (*(t+1) == ' ' || *(t+1) == '\t')) {
+        t = index(t+1, '\n');
+    }
+    len = t ? (t-s+1) : (strlen(s)+1);
+    newcopy = XMALLOC(char, len+3); /* two extra bytes for a bizarre bug caused
+                                       by the fact that FindParam calls
+				       FreshHeaderCopy and sometimes tacks on
+				       "--".
+				    */
+    strncpy(newcopy, s, len);
+    newcopy[len] = 0;
+    return(newcopy);
+}
+
+Read822Prefix(PrintHeads, nestingdepth)
+int PrintHeads, nestingdepth;
+{
+    int SawNewline = 1, bytes = 0, alloced = 1000, HasEncodedChars=0;
+    int c, oldbytes;
+    char *s, *t, *tmp;
+
+    if (!PrintSomeHeaders) PrintHeads = 0;
+    mailheaders = XMALLOC(char, alloced+1);
+    strcpy(mailheaders, "MM_HEADERS=\n");
+    bytes = 12;
+yankagain:
+    t = mailheaders + bytes;
+    oldbytes = bytes-1; /* a hack for YankMode */
+    while ((c = getc(InputFP)) != EOF) {
+        if (++bytes >= alloced) {
+            alloced += 1000;
+            mailheaders = realloc(mailheaders, alloced);
+            t = mailheaders + bytes - 1;
+        }
+        if (c == '\n') {
+            if (SawNewline) break;
+            SawNewline = 1;
+        } else SawNewline = 0;
+        *t++ = c;
+    }
+    *t = 0;
+    --bytes;
+    if (c == EOF) {
+	if (nestingdepth) {
+	    fprintf(stderr, "metamail: Incomplete multipart message -- unexpected EOF\n");
+/*            exit(ProcessingErrors); */
+        } else {
+            if (YankMode) {
+/*                ExitWithError("Could not extract a MIME message from the  body\n"); */
+		fprintf(stderr, "metamail: Could not extract a MIME message from the body\n");
+            } else {
+		fprintf(stderr, "metamail: Could not find end of mail headers.\n");
+/*                ExitWithError("Could not find end of mail headers"); */
+            }
+	}
+	BoundaryCt=0;
+	return -1;
+    }
+    for (s=mailheaders+oldbytes; *s; ++s) {
+        if (*s == '\n' && (*(s+1) != ' ') && (*(s+1) != '\t')) {
+	    if (!ContentType && !lc2strncmp(s, "\ncontent-type:", 14)) {
+		char *dum;
+                ContentType = FreshHeaderCopy(s+14);
+		/* Eliminate white space embedded in content-type */
+		while (1) {
+		    dum = index(ContentType, '/');
+		    if (!dum) break;
+		    if (isspace(*(dum-1))) {
+			for (--dum; *dum; ++dum) {
+			    *dum = *(dum+1);
+			}
+		    } else if (isspace(*++dum)) {
+			for ( ; *dum; ++dum) {
+			    *dum = *(dum+1);
+			}
+		    } else {
+			break;
+		    }
+		}
+                StripTrailingSpace(ContentType);
+                ParseContentParameters(ContentType);
+                if (PrintHeads) maybephead(s+1);
+            } else if (!ContentEncoding && !lc2strncmp(s, "\ncontent-transfer-encoding:", 27)) {
+                ContentEncoding = FreshHeaderCopy(s+27);
+                if (PrintHeads) maybephead(s+1);
+            } else if (!lc2strncmp(s, "\nsubject:", 9)) {
+                if (PrintHeads) maybephead(s+1);
+                MailSubject = FreshHeaderCopy(s+9);
+            } else if (!lc2strncmp(s, "\nfrom:", 6)) {
+                if (PrintHeads) maybephead(s+1);
+                MailFrom = FreshHeaderCopy(s+6);
+            } else if (!lc2strncmp(s, "\ncontent-description:", 4)) {
+                if(PrintHeads) maybephead(s+1);
+                MailSubject = FreshHeaderCopy(s+21);
+            } else {
+                /* Print any with encoded variables */
+                char *dum = s;
+                while (dum) {
+                    dum = index(dum, '?');
+                    if (dum && *++dum == '=') break;
+                }
+                if (dum) {
+                    char *nl = s+1;
+                    while (nl) {
+                        nl = index(nl, '\n');
+                        if (nl && !isspace((unsigned char) *++nl)) break;
+                    }
+                    if (nl && nl > dum) ++HasEncodedChars;
+                }
+                if (HasEncodedChars) {
+                    phead(s+1);
+                } else if (PrintHeads) {
+                    maybephead(s+1);
+                }
+            }
+        }
+    }
+    /* Ugly, but effective */
+    if (YankMode && !ContentType) {
+        goto yankagain;
+    }
+    if (PrintHeads) printf("\n");
+    if (!ContentType) {
+        ContentType = "text/plain";
+        CParamsUsed=0;
+    }
+    for (tmp=ContentType; *tmp; ++tmp) {
+        if (isupper((unsigned char) *tmp)) *tmp = tolower((unsigned char) *tmp);
+    }
+    return 0;
+}
+
+PrepareMessage() {
+    int c;
+
+    EncodingCode = ENCODING_NONE;
+    if (ContentEncoding) {
+        /* strip leading white space */
+        while (*ContentEncoding && isspace((unsigned char) *ContentEncoding)) ++ContentEncoding;
+        StripTrailingSpace(ContentEncoding);
+        if (!lc2strcmp(ContentEncoding, "base64")) {
+            EncodingCode = ENCODING_BASE64;
+        } else if (!lc2strcmp(ContentEncoding, "quoted-printable")) {
+            EncodingCode = ENCODING_QUOTEDPRINTABLE;
+        } else if (!lc2strncmp (ContentEncoding, "x-uue", 5)) {
+            fprintf (stderr, "WARNING:  Using nonstandard %s encoding, trying uuencode algorithm.\n", ContentEncoding);
+ 	    EncodingCode = ENCODING_UUENCODE;
+        } else {
+            if (lc2strcmp(ContentEncoding, "none")
+                 && !lc2strcmp(ContentEncoding, "8bit")
+                 && !lc2strcmp(ContentEncoding, "7bit")) {
+                fprintf(stderr, "Ignoring unrecognized Content-Transfer-Encoding value: %s\n", ContentEncoding);
+            }
+        }
+    }
+    if (EatLeadingNewlines) {
+        while ((c = getc(InputFP)) != EOF) {
+            if (c != '\n') {
+                ungetc(c, InputFP);
+                break;
+            }
+        }
+    }
+    SetUpEnvironment();  
+}
+
+SetUpEnvironment() { 
+    int i, j, environsize;
+    char **newenviron, *mailervar, *summaryvar, *ctypevar, *s;
+    static char ttyenv[15], debugenv[15], *noaskenv, pagerenv[15], *quietenv, rootenv[25];
+
+    /* Hack to make the code look similar for unix & dos */
+#define putenv(var)        newenviron[i++] = var;
+    for (environsize=0; environ[environsize]; ++environsize) {
+	;
+    }
+    newenviron = XMALLOC(char *, 17+environsize);
+    mailervar = XMALLOC(char, 13+strlen(MailerName));
+    sprintf(mailervar, "MM_MAILER=%s", MailerName);
+    summaryvar = XMALLOC(char, 26 + strlen(MailFrom) + strlen(MailSubject));
+    sprintf(summaryvar, "MM_SUMMARY=%s (from %s)", MailSubject, MailFrom);
+    MailSummary = summaryvar+11;
+    EliminateNastyChars(MailSummary);
+    i = 0;
+    if (ContentType) {
+        int ctypelen = 22+strlen(ContentType);
+        for (j=0; j<CParamsUsed; ++j) {
+            ctypelen += 6 + strlen(CParams[j]) + strlen(CParamValues[j]);
+        }
+        ctypevar = XMALLOC(char, ctypelen);
+        for (s=ContentType; *s; ++s) {
+            if (isupper((unsigned char) *s)) *s = tolower((unsigned char) *s);
+        }
+        while (isspace((unsigned char) *--s)) *s = 0;
+        sprintf(ctypevar, "MM_CONTENTTYPE=%s", ContentType);
+        for (j=0; j<CParamsUsed; ++j) {
+            strcat(ctypevar, " ; ");
+            strcat(ctypevar, CParams[j]);
+            strcat(ctypevar, " = ");
+            strcat(ctypevar, CParamValues[j]);
+        }
+        putenv(ctypevar);
+    }
+    putenv(mailheaders ? mailheaders : "MM_HEADERS=unknown");
+    putenv(mailervar);
+    putenv(summaryvar);
+    sprintf(ttyenv, "MM_NOTTTY=%d", DefinitelyNotTty);
+    putenv(ttyenv);
+    sprintf(debugenv, "MM_DEBUG=%d", DoDebug);
+    putenv(debugenv);
+    s = getenv("MM_QUIET");
+    if (!s) s = QuietDefault;
+    quietenv = XMALLOC(char, 15 + strlen(s));
+    if (Quiet) {
+        strcpy(quietenv, "MM_QUIET=1");
+    } else {
+        sprintf(quietenv, "MM_QUIET=%s", s);
+    }
+    putenv(quietenv);
+    s = getenv("MM_NOASK");
+    if (!s) s = NoAskDefault;
+    noaskenv = XMALLOC(char, 15 + strlen(s));
+    if (MightAskBeforeExecuting) {
+        sprintf(noaskenv, "MM_NOASK=%s", s);
+    } else {
+        strcpy(noaskenv, "MM_NOASK=1");
+    }
+    putenv(noaskenv);
+    s = getenv("MM_RUNASROOT");
+    if (!s) s = "0";
+    sprintf(rootenv, "MM_RUNASROOT=%s", s);
+    putenv(rootenv);
+    sprintf(pagerenv, "MM_USEPAGER=%d", MaybePageOutput);
+    putenv(pagerenv);
+    for (j=0; j<environsize; ++j) {
+        if (strncmp(environ[j], "MM_", 3) || !strncmp(environ[j], "MM_CHARSET", 10)) {
+            putenv(environ[j]);
+        }
+    }
+    newenviron[i] = NULL;
+    environ = newenviron;
+    if (DoDebug) {
+        printf("Here is the environment:\n\n");
+        system("printenv");
+    }
+}
+
+
+OKToRun(ctype, progname, label)
+char *ctype, *progname, *label;
+{
+    char AnsBuf[100], *s;
+
+    if (DoInBackground) return(1);
+    if (DefinitelyNotTty || MustNotBeTty) return(1);
+    while (1) {
+        printf("\n");
+        if (label) {
+            printf("This message contains %s.\nDo you want to view it using the '%s' command (y/n) [y] ? ", label, ShortCommand(progname));
+        } else {
+            printf("This message contains '%s'-format data.\nDo you want to view it using the '%s' command (y/n) [y] ? ", ctype, ShortCommand(progname));
+        }
+        s = fgets(AnsBuf, sizeof(AnsBuf), stdin);
+        if (!s) return(0); /* EOF */
+	while (s && *s && isspace((unsigned char) *s)) ++s;
+	if (*s == 'y' || *s == 'Y' || !*s || *s == '\n') return(1);
+	if (*s == 'n' || *s == 'N' || *s == 'q' || *s == 'Q') {
+	    return(0);
+	}
+	printf("Please answer yes or no.\n");
+    }
+}
+
+EliminateNastyChars(s)
+char *s;
+{
+    if (s) for( ; *s ;++s) {
+        if (isalnum((unsigned char) *s)) continue;
+	if (index(" ,.;:/?\\|[]{}()*&^%#@-_=+~<>\"", *s)) continue;
+	if (*s == '\'' || *s == '`') {
+	    *s = '"';
+	} else {
+	    *s = ' ';
+	}
+    }
+}
+
+StripTrailingSpace(s)
+char *s;
+{
+    char *t = s+strlen(s) -1;
+    while (isspace((unsigned char) *t) && (t >= s)) *t-- = 0;
+}
+
+static char *KeyHeads=NULL;
+static char **KeyHeadList;
+static int KeyKeep = 0;
+
+void setKeyHeads()
+{
+    char *s;
+    int numkeys = 0;
+
+    if ((KeyHeads = getenv("KEYHEADS")) != 0) {
+        for (s=KeyHeads;*s;++s) if (isupper((unsigned char) *s)) *s=tolower((unsigned char) *s);
+    } else if ((KeyHeads = getenv("KEYIGNHEADS")) != 0) {
+	for (s=KeyHeads;*s;++s) if (isupper((unsigned char) *s)) *s=tolower((unsigned char) *s);
+	KeyKeep = 1;
+    } else {
+	static char khtmp[] = "to:cc:subject:from:content-description:date";
+	KeyHeads = khtmp;
+    }
+    for (s=KeyHeads; *s; ++s) if (*s == ':') ++numkeys;
+    numkeys += 2;
+    KeyHeadList = XMALLOC(char *, numkeys);
+    numkeys = 0;
+    KeyHeadList[0] = KeyHeads;
+    for(s=KeyHeads; *s; ++s) {
+	if (*s == ':') {
+	    *s = '\0';
+	    KeyHeadList[++numkeys] = s+1;
+	}
+    }
+    KeyHeadList[++numkeys] = NULL;
+}
+
+/* find the first colon in a header line which appears before any spaces or control characters */
+char *
+findcolon(hdr)
+char *hdr;
+{
+    while (*hdr && !isspace(*hdr) && !iscntrl(*hdr))
+	if (*hdr == ':') return hdr;
+	else hdr++;
+    return 0;
+}
+
+/* check the header given to see if it matches any in the KeyHeadList */
+maybephead(hdr)
+char *hdr;
+{
+    char *s;
+    int numkeys=0;
+
+    if (!KeyHeads) setKeyHeads();
+
+    s = findcolon(hdr);
+    if (s) {
+	int len = s - hdr;
+        for (numkeys=0; KeyHeadList[numkeys]; ++numkeys) {
+            if (!strcmp(KeyHeadList[numkeys], "*")
+                 || !lc2strncmp(hdr, KeyHeadList[numkeys], len)) {
+		if (!KeyKeep) phead(hdr);
+		return;
+            }
+        }
+	if (KeyKeep) phead(hdr);
+	return;
+    }
+    if (!strncmp(hdr, "From ", 5) || !strncmp(hdr, ">From ", 6)) {
+	for (numkeys = 0; KeyHeadList[numkeys]; ++numkeys) {
+	    if (!strcmp(KeyHeadList[numkeys], "*")
+		 || !lc2strncmp(">from", KeyHeadList[numkeys], 5)) {
+		if (!KeyKeep) phead(hdr);
+		return;
+	    }
+	}
+	if (KeyKeep) phead(hdr);
+    }
+}
+
+/* This next routine prints out a mail header, and needs to deal with the new extended charset headers. */
+phead(s)
+char *s;
+{
+    char *t = s;
+
+    while (1) {
+	t = index(t, '\n');
+	if (!t) break;
+        if (!isspace((unsigned char) *(t+1))) {
+            *t = 0;
+	    break;
+	} else ++t;
+    }
+    PrintHeader(s, 1);
+    printf("\n");
+    if (t) *t = '\n';
+}
+
+static char PrevCharset[100] = "us-ascii";
+
+/* This is the part that actually handles the charset issues */
+void PrintHeader(s, ShowLeadingWhitespace)
+char *s;
+int ShowLeadingWhitespace;
+{
+    char *charset, *encoding, *txt, *txtend, TmpFile[TMPNAME_MAX];
+    int ecode = ENCODING_NONE, CorrectedCharset = 0;
+    FILE *fp;
+
+    while (*s && (*s != '=')) {
+        if (isspace((unsigned char) *s)) {
+            if (ShowLeadingWhitespace) {
+                putchar(' ');
+            }
+        } else {
+            putchar(*s);
+            if (!CorrectedCharset) {
+                CorrectedCharset = 1;
+                strcpy(PrevCharset, "us-ascii");
+            }
+        }
+        if (!ShowLeadingWhitespace) {
+            /* Only at most one leading space is ignored */
+            ShowLeadingWhitespace = 1;
+        }
+        ++s;
+    }
+    if (!*s) return;
+    if (*(s+1) != '?') {
+        putchar('=');
+        PrintHeader(++s, 1);
+        return;
+    }
+    charset = s+2;
+    encoding = index(charset, '?');
+    if (!encoding) {
+        putchar('=');
+        PrintHeader(++s,1);
+        return;
+    }
+    txt = index(encoding+1, '?');
+    if (!txt) {
+        putchar('=');
+        PrintHeader(++s, 1);
+        return;
+    }
+    txtend = txt;
+    do {
+        txtend = index(txtend+1, '?');
+    } while(txtend && (*(txtend+1) != '='));
+    if (!txtend) {
+        putchar('=');
+        PrintHeader(++s, 1);
+    }
+    /* Proper parse! Ready to dissect... */
+    *encoding = 0;
+    *txt = 0;
+    *txtend = 0;
+    if ((*(encoding+1) == 'q') || (*(encoding+1) == 'Q')) {
+        ecode = ENCODING_QUOTEDPRINTABLE;
+    } else if ((*(encoding+1) == 'b') || (*(encoding+1) == 'B')) {
+        ecode = ENCODING_BASE64;
+    } else {
+        fprintf(stderr, "Bad encoding value in non-ASCII header string: %s\n", encoding+1);
+    }
+    if (lc2strcmp(charset, PrevCharset)) {
+        char *s2, *charsetinuse;
+
+        strncpy(PrevCharset, charset, sizeof(PrevCharset));
+        PrevCharset[sizeof(PrevCharset) - 1] = '\0';
+        for (s2=PrevCharset; *s2; ++s2) {
+            if (isupper((unsigned char) *s2)) *s2 = tolower((unsigned char) *s2);
+        }
+        charsetinuse = getenv("MM_CHARSET");
+        if (!charsetinuse || lc2strcmp(charsetinuse, PrevCharset)) {
+            printf("[** %s charset **] ", charset);
+        }
+    }
+    if (ecode == ENCODING_NONE) {
+        printf("%s", txt+1);
+    } else {
+        /* What follows is REALLY bogus, but all my encoding stuff is pipe-oriented right now... */
+        MkTmpFileName(TmpFile);
+        fp = fopen(TmpFile, WRITE_BINARY);
+        if (!fp) {
+            fprintf(stderr, "Could not open temporary file\n");
+        } else {
+            char *t;
+            for (t=txt+1; *t; ++t) {
+                if (*t == '_') {
+                    putc(' ', fp);
+                } else if (*t == '\n') {
+                    putc(' ', fp);
+                } else {
+                    putc(*t, fp);
+                }
+            }
+            fclose(fp);
+            fp = fopen(TmpFile, "r");
+            if (!fp) {
+                fprintf(stderr, "Could not open temporary file\n");
+            } else {
+                TranslateInputToOutput(fp, stdout, ecode, "text");
+                fclose(fp);
+            }
+            RmTmpFileName(TmpFile);
+        }
+    }
+    *encoding = '?';
+    *txt = '?';
+    *txtend = '?';
+    PrintHeader(txtend + 2, 0);
+}
+
+BuildCommand(Buf, controlstring, TmpFileName, UsedTmpFileName, PartsWritten)
+char *Buf, *controlstring, *TmpFileName;
+int *UsedTmpFileName;
+struct part **PartsWritten;
+{
+    char *from, *to, *s, *p, *tmp;
+    int prefixed = 0, UsedBigFile=0, UsedLittleFiles=0, numparts=0;
+    struct part *firstpart=NULL, *thispart=NULL, *tmppart=NULL;
+
+    if (UsedTmpFileName) *UsedTmpFileName = 0;
+    if (PartsWritten) *PartsWritten = NULL;
+    for (from=controlstring, to=Buf; *from; ++from) {
+        if (prefixed) {
+            prefixed = 0;
+            switch(*from) {
+                case '%':
+                    *to++ = '%';
+                    break;
+                case 'n':
+                case 'F':
+		    if (!PartsWritten) {
+			fprintf(stderr, "metamail: Bad mailcap \"test\" clause: %s\n", controlstring);
+			ExitWithError("%%n and %%F may not be used in \"test\" clauses.  Execution terminated.");
+		    }
+                    if (UsedBigFile) {
+                        fprintf(stderr, "metamail: Bad mailcap entry: %s\n", controlstring);
+                        ExitWithError("%%n and %%F are incompatible with %%s.  Execution terminated.");
+                    }
+                    if (!UsedLittleFiles) {
+                        /* Set up parts */
+                        char *LineBuf, *boundary, TmpFileNameBuf[TMPNAME_MAX];
+                        char *oldct, *oldce, *newct;
+                        int currct, boundarylen, newctlen, j;
+                        int oldcparmsused, oldcparamsalloced;
+                        char **oldcparams, **oldcparamvalues;
+                        FILE *headfp;
+
+                        LineBuf = XMALLOC(char, LINE_BUF_SIZE);
+                        boundary = FindParam("boundary");
+			if (!boundary) {
+			    fprintf(stderr, "Bad message format: This multipart message has no boundary parameter,\n");
+			    fprintf(stderr, "but the mailcap entry for %s uses %%F or %%n.\n\n", ContentType);
+			    ExitWithError("A change to the mailcap file might make this message viewable.");
+                        }
+                        if (boundary[0] == '"') {
+                            boundary=UnquoteString(boundary);
+                        }
+                        sprintf(LineBuf, "--%s", boundary);
+                        strcpy(boundary, LineBuf);
+                        boundarylen = strlen(boundary);
+                        if (BoundaryCt >= BoundaryAlloc) {
+                            BoundaryAlloc += 5;
+                            if (Boundaries) {
+                                Boundaries = XREALLOC(char *, Boundaries,
+						      BoundaryAlloc);
+                            } else {
+                                Boundaries = XMALLOC(char *, BoundaryAlloc);
+                            }
+                        }
+                        Boundaries[BoundaryCt++] = boundary;
+                        while (fgets(LineBuf, LINE_BUF_SIZE, InputFP)) { /* find start */
+                            if (!strncmp(LineBuf, boundary, boundarylen)
+                                 && ((LineBuf[boundarylen] == '\n')
+                                      || (LineBuf[boundarylen] == '-'
+                                           && LineBuf[boundarylen+1] == '-'
+                                           && LineBuf[boundarylen+2] == '\n'))) {
+                                break;
+                            }
+                        }
+                        XFREE(LineBuf);
+                        currct = BoundaryCt;
+                        oldct=ContentType;
+                        oldce=ContentEncoding;
+                        oldcparmsused = CParamsUsed;
+                        oldcparamsalloced = CParamsAlloced;
+                        oldcparams = CParams;
+                        oldcparamvalues = CParamValues;
+                        CParams = NULL;
+                        CParamValues = NULL;
+                        CParamsUsed = 0;
+                        CParamsAlloced = 0;
+                        while(currct == BoundaryCt) {
+                            tmppart = XMALLOC(struct part, 1);
+                            if (firstpart) {
+                                thispart->next = tmppart;
+                                thispart = tmppart;
+                            } else {
+                                firstpart = thispart = tmppart;
+                            }
+                            tmppart->next = NULL;
+                            ContentType=NULL;
+                            ContentEncoding=NULL;
+                            Read822Prefix(0,0);
+                            PrepareMessage();
+                            newctlen=5+strlen(ContentType);
+                            for (j=0; j<CParamsUsed; ++j) {
+                                newctlen += 11+strlen(CParams[j]) + strlen(CParamValues[j]);
+                            }
+                            newct= XMALLOC(char, newctlen);
+                            strcpy(newct, "'");
+                            strcat(newct, ContentType);
+                            for (j=0; j<CParamsUsed; ++j) {
+                                strcat(newct, "; ");
+                                strcat(newct, CParams[j]);
+                                if (CParamValues[j][0] == '\"') {
+                                    strcat(newct, " = ");
+                                    strcat(newct, CParamValues[j]);
+                                } else {
+                                    strcat(newct, " = \"");
+                                    strcat(newct, CParamValues[j]);
+                                    strcat(newct, "\"");
+                                }
+                            }
+                            strcat(newct, "'");
+                            thispart->ctype = newct;
+                            MkTmpFileName(TmpFileNameBuf);
+                            thispart->fname = XMALLOC(char,
+						     1+strlen(TmpFileNameBuf));
+                            strcpy(thispart->fname, TmpFileNameBuf);
+                            WriteTmpFile(thispart->fname, thispart->ctype);
+                            strcat(TmpFileNameBuf, "H");
+                            headfp = fopen(TmpFileNameBuf, "w");
+                            if (headfp) {
+                                fputs(mailheaders+12, headfp);
+                                /* The +12 gets rid of MM_HEADERS=\n */
+                                fclose(headfp);
+                            }
+                            ++numparts;
+                        }
+                        ContentType=oldct;
+                        ContentEncoding=oldce;
+                        CParamsUsed = oldcparmsused;
+                        CParamsAlloced = oldcparamsalloced;
+                        CParams = oldcparams;
+                        CParamValues = oldcparamvalues;
+                        /* Now we've seen the last encapsulation boundary, but if there is a "postfix"
+                            we must throw it away.*/
+                        if (BoundaryCt > 0) {
+                            ConsumeRestOfPart(NULL);
+                        }
+                        *PartsWritten = firstpart;
+                        UsedLittleFiles=1;
+                    }
+                    if (*from == 'n') {
+                        char numbuf[10];
+                        sprintf(numbuf, "%d", numparts);
+                        strcpy(to, numbuf);
+                        to += strlen(numbuf);
+                    } else { /* %F */
+                        for (tmppart = firstpart; tmppart != NULL; tmppart = tmppart->next) {
+                            sprintf(to, "%s %s ", tmppart->ctype, tmppart->fname);
+                            to += (strlen(tmppart->ctype) + strlen(tmppart->fname) + 2);
+                        }
+                    }
+                    break;
+                case 's':
+                    if (UsedLittleFiles) {
+                        fprintf(stderr, "metamail: Bad mailcap entry: %s\n", controlstring);
+                        ExitWithError("%%n and %%F are incompatible with %%s.  Execution terminated.");
+                    }
+                    if (TmpFileName) {
+                        strcpy(to, TmpFileName);
+                        to += strlen(TmpFileName);
+                        if (UsedTmpFileName) ++(*UsedTmpFileName);
+                    }
+                    UsedBigFile = 1;
+                    break;
+                case '{':
+                    s = index(from, '}');
+                    if (!s) {
+                        fprintf(stderr, "Ignoring ill-formed parameter reference in mailcap file: %s\n", from);
+                        break;
+                    }
+                    ++from;
+                    *s = 0;
+                    /* put in lower case */
+                    for (tmp=from; *tmp; ++tmp) {
+                        if (isupper((unsigned char) *tmp)) *tmp = tolower((unsigned char) *tmp);
+                    }
+                    p = FindParam(from);
+                    if (p && p[0] == '"') {
+                        p=UnquoteString(p);
+                    }
+                    if (!p) p = "";
+                    *to++ = '\'';
+                    strcpynoquotes(to, p);
+                    to += strlen(p);
+                    *to++ = '\'';
+                    *s = '}'; /* restore */
+                    from = s;
+                    break;
+                case 't':
+                    /* type/subtype */
+                    strcpynoquotes(to, ContentType);
+                    to += strlen(ContentType);
+                    break;
+                default:
+                    fprintf(stderr, "Ignoring unrecognized format code in mailcap file: %%%c\n", *from);
+                    break;
+            }
+        } else if (*from == '%') {
+            prefixed = 1;
+        } else {
+            *to++ = *from;
+        }
+    }
+    *to = 0;
+}
+
+strcpynoquotes(t,f)
+char *t, *f;
+{
+    static char *badchars="|<>%*?\"`'";
+
+    while (*f) {
+        if (index(badchars, *f)) *t++ = ' '; else *t++ = *f;
+        ++f;
+    }
+}
+
+WriteTmpFile(fname, ctype)
+char *fname;
+char *ctype;
+{
+    FILE *fpout;
+    int retval = 0;
+
+    fpout = fopen(fname, WRITE_BINARY);
+    if (!fpout) {
+        perror("WriteTmpFile");
+        metamail_fatal("Can't create temporary file: ", fname);
+    }
+    TranslateInputToOutput(InputFP, fpout, EncodingCode, ctype);
+    if (ftell(fpout) == 0) retval = 1;
+    if (fclose(fpout)) ExitWithError("Can't write temporary file");
+    return(retval);
+}
+
+
+TranslateInputToOutput(InputFP, OutputFP, Ecode, ctype)
+FILE *InputFP, *OutputFP;
+int Ecode;
+char *ctype;
+{
+    int InMultipart = BoundaryCt > 0 ? 1 : 0;
+
+    switch(Ecode) {
+        case ENCODING_BASE64:
+            from64(InputFP, OutputFP, InMultipart ? Boundaries : NULL, &BoundaryCt, DoesNeedPortableNewlines(ctype));
+            break;
+        case ENCODING_QUOTEDPRINTABLE:
+            fromqp(InputFP, OutputFP, InMultipart ? Boundaries : NULL, &BoundaryCt);
+            break;
+ 	case ENCODING_UUENCODE:
+ 	    fromuue(InputFP, OutputFP, InMultipart ? Boundaries: NULL, &BoundaryCt);
+ 	    break;
+        default:
+            ConsumeRestOfPart(OutputFP);
+    }
+    if (UsingStandardInput && feof(InputFP) && !freopen("/dev/tty", "r", stdin)) {
+        fprintf(stderr, "Warning: Cannot freopen /dev/tty to stdin");
+    } else InputFP = stdin;
+}
+
+CreateNewWindowPrefix(Prefix)
+char *Prefix;
+{
+    char *override = getenv("TERMINAL_CMD");
+    if (override) {
+        strcpy(Prefix, override);
+    } else if (getenv("DISPLAY")) {
+        /* X11 */
+        strcpy(Prefix, "xterm -title '");
+        strcat(Prefix, MailSummary);
+        strcat(Prefix, "' -e ");
+    } else if (getenv("WINDOW_PARENT")) {
+        /* SunView */
+        strcpy(Prefix, "shelltool ");
+    } else if (getenv("WMHOST")) {
+        /* old Andrew WM */
+        strcpy(Prefix, "h19 ");
+    } else {
+        /* last resort is to look for /dev/tty */
+        if (!freopen("/dev/tty", "r", stdin)){
+            ExitWithError("Don't know how to create a terminal window");
+        }
+        InputFP = stdin;
+        fprintf(stderr, "Warning, reopened /dev/tty, could be strange.\n");
+        Prefix[0] = 0;
+    }
+}
+
+int HasSavedTtyState=0;
+
+SaveTtyState() {
+    /* Bogus -- would like a good portable way to reset the terminal state here */
+  ioctl(fileno(stdin), TCGETA, &MyTtyStateIn);
+  ioctl(fileno(stdout), TCGETA, &MyTtyStateOut);
+
+  HasSavedTtyState = 1;
+  }
+
+RestoreTtyState() {
+    if (HasSavedTtyState) {
+        ioctl(fileno(stdout), TCSETA, &MyTtyStateOut);
+        ioctl(fileno(stdin), TCSETA, &MyTtyStateIn);
+    }
+}
+
+NeedToAskBeforeExecuting(type)
+char *type;
+{
+    struct NoAskItem *nai;
+    if (!MightAskBeforeExecuting || DoInBackground) return(0);
+    for (nai = FirstNoAskItem; nai; nai = nai->next) {
+        if (CtypeMatch(type, nai->type)) return(0);
+    }
+    return(1);
+}
+
+NeedToBeQuiet(cmd)
+char *cmd;
+{
+    struct NoAskItem *nai;
+    for (nai = FirstQuietItem; nai; nai = nai->next) {
+        if (!lc2strcmp(nai->type, cmd)) return(1);
+    }
+    return(0);
+}
+
+CtypeMatch(ctype, pat)
+char *ctype, *pat;
+{
+    int len;
+    char pat2[200];
+
+    if (!lc2strcmp(ctype, pat)) {
+        return(1); /* exact match, case-insensitive */
+    }
+    if (index(pat, '/') == NULL) {
+        /* implicit wildcard */
+        strcpy(pat2, pat);
+        strcat(pat2, "/*");
+        pat = pat2;
+    }
+    len = strlen(pat);
+    if ((pat[--len] == '*')
+         && (pat[--len] == '/')
+         && (!lc2strncmp(ctype, pat, len))
+         && ((ctype[len] == '/') || (ctype[len] == '\0'))){
+        /* wildcard match */
+        return(1);
+    }
+    return(0);
+}
+
+ExecuteCommand(cmd, really)
+char *cmd;
+int really;
+{
+    int code;
+    if (!Quiet || DoDebug) {
+        if (!NeedToBeQuiet(ShortCommand(cmd))) {
+            printf("---Executing: %s\n", DoDebug ? cmd : ShortCommand(cmd));
+        } else if (EatLeadingNewlines) {
+            printf("\n");
+        } 
+        fflush(stdout);
+    }
+    if (really) {
+        fflush(stdout); fflush(stderr);
+        code = system(cmd);
+        if (DoDebug) printf("Command exit status: %d\n", code);
+        return(code);
+    }
+    return(0);
+}
+
+void
+ConsumeRestOfPart(outfp)
+FILE *outfp;
+{
+    char *Buf;
+    int c;
+
+    if (BoundaryCt <= 0) {
+        while ((c=getc(InputFP)) != EOF) {
+            if (outfp) putc(c, outfp);
+        }
+        return;
+    }
+    Buf = XMALLOC(char, LINE_BUF_SIZE);
+    while (fgets(Buf, LINE_BUF_SIZE, InputFP)) {
+        if ((BoundaryCt > 0)
+             && (Buf[0] == '-')
+             && (Buf[1] == '-')
+             && PendingBoundary(Buf, Boundaries, &BoundaryCt)) {
+            break;
+        }
+        if (outfp) fputs(Buf, outfp);
+    }
+    XFREE(Buf);
+}
+
+char *paramend(s)
+char *s;
+{
+    int inquotes=0;
+    while (*s) {
+        if (inquotes) {
+            if (*s == '"') {
+                inquotes = 0;
+            } else if (*s == '\\') {
+                ++s; /* skip a char */
+            }
+        } else if (*s == ';') {
+            return(s);
+        } else if (*s == '"') {
+            inquotes = 1;
+        }
+        ++s;
+    }
+    return(NULL);
+}        
+
+void
+ParseContentParameters(ct)
+char *ct;
+{
+    char *s, *t, *eq;
+
+    CParamsUsed = 0;
+    s = index(ct, ';');
+    if (!s) return;
+    *s++ = 0;
+    do {
+        t = paramend(s);
+        if (t) *t++ = 0;
+        eq = index(s, '=');
+        if (!eq) {
+            fprintf(stderr, "Ignoring unparsable content-type parameter: '%s'\n", s);
+            JunkParameter=Cleanse(s);
+        } else {
+            if (CParamsUsed >= CParamsAlloced) {
+                CParamsAlloced += 10;
+                if (CParams) {
+                    CParams = XREALLOC(char *, CParams, 1+CParamsAlloced);
+                    CParamValues = XREALLOC(char *, CParamValues, 
+					    1+CParamsAlloced);
+                } else {
+                    CParams = XMALLOC(char*, 1+CParamsAlloced);
+                    CParamValues = XMALLOC(char *, 1+CParamsAlloced);
+                }
+            }
+            *eq++ = 0;
+            s = Cleanse(s);
+            CParams[CParamsUsed] = s;
+            /* strip leading white space */
+            while (*eq && isspace((unsigned char) *eq)) ++eq;
+            /* strip trailing white space */
+            StripTrailingSpace(eq);
+            CParamValues[CParamsUsed++] = eq; 
+            if (DoDebug) printf("NEW PARAMETER: %s VALUE: %s\n", s, eq);
+        }
+        s = t;
+    } while (t);
+}
+
+char *FindParam(s)
+char *s;
+{
+    int i;
+    for (i=0; i<CParamsUsed; ++i) {
+        if (!strcmp(s, CParams[i])) {
+            return(CParamValues[i]);
+        }
+    }
+    return(NULL);
+}
+
+strcatquoting(s1, s2)
+char *s1;
+char *s2;
+{
+    strcat(s1, s2);
+#ifdef NOTDEF
+    while (*s1) ++s1;
+    while (*s2) {
+        if (*s2 == '\"' || *s2 == '\\') *s1++ = '\\';
+        *s1++ = *s2++;
+    }
+    *s1 = '\0';
+#endif
+}
+
+PauseForUser() {
+    if (DefinitelyNotTty || MustNotBeTty) return;	
+
+    fflush(stdout);
+    SaveTtyState();
+    if (StartRawStdin() != -1) {
+        printf("--Press any key to go on.--");
+    } else {
+        printf("Press RETURN to go on.\n");
+    }
+    fflush(stdout);
+    getchar();
+    RestoreTtyState();
+    printf("\n");
+}
+
+StartRawStdin() {
+    struct termio   orterm, fterm;
+    ioctl(0, TCGETA, &orterm);	/* get current (i.e. cooked) termio */
+    fterm = orterm;		/* get termio to modify */
+
+    fterm.c_lflag &= ~ICANON;	/* clear ICANON giving raw mode */
+    fterm.c_cc[VMIN] = 1;	/* set MIN char count to 1 */
+    fterm.c_cc[VTIME] = 0;	/* set NO time limit */
+    return ioctl(0, TCSETAW, &fterm);	/* modify termio for raw mode */
+}
+
+
+int IsDirectory(fname)
+char *fname;
+{
+    struct stat stbuf;
+    if (stat(fname, &stbuf)) {
+	return(-1);
+    }
+    return (((stbuf.st_mode & S_IFMT) == S_IFDIR) ? 1 : 0);
+}
+
--- metamail-2.7.orig/src/metamail/dlistold.h
+++ metamail-2.7/src/metamail/dlistold.h
@@ -0,0 +1,36 @@
+// Copyright: Michael Moerz 2000
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License with
+// the Debian GNU/Linux distribution in file /usr/share/doc/common-licenses/GPL
+// if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+// Suite 330, Boston, MA  02111-1307  USA
+
+#ifndef DRF_LIST_H
+#define DRF_LIST_H 1
+
+typedef struct dlist {
+  struct dlist* next;
+  struct dlist* prev;
+  void* data;
+} DList;
+
+extern DList* dlist_new        (void* data);
+extern void   dlist_cat        (DList* tail_l1, DList* head_l2);
+extern DList* dlist_insertnew  (DList** tail, void* data);
+extern DList* dlist_insert     (DList** tail, DList* new);
+extern DList* dlist_head       (DList* head);
+extern DList* dlist_tail       (DList* head);
+extern size_t dlist_length     (DList* head);
+extern DList* dlist_remove     (DList** head, DList** tail, DList* entry);
+
+#endif /* !DRF_LIST_H */
--- metamail-2.7.orig/src/metamail/mimencode.c
+++ metamail-2.7/src/metamail/mimencode.c
@@ -0,0 +1,95 @@
+/*
+Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
+
+Permission to use, copy, modify, and distribute this material 
+for any purpose and without fee is hereby granted, provided 
+that the above copyright notice and this permission notice 
+appear in all copies, and that the name of Bellcore not be 
+used in advertising or publicity pertaining to this 
+material without the specific, prior written permission 
+of an authorized representative of Bellcore.  BELLCORE 
+MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
+OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
+WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+*/
+#include <metamail/common.h>
+
+//#ifdef MSDOS
+//#include <fcntl.h>
+//#endif
+
+#define BASE64 1
+#define QP 2 /* quoted-printable */
+
+main(argc, argv)
+int argc;
+char **argv;
+{
+    int encode = 1, which = BASE64, i, portablenewlines = 0;
+    FILE *fp = stdin;
+    FILE *fpo = stdout;
+
+    for (i=1; i<argc; ++i) {
+        if (argv[i][0] == '-') {
+	    switch (argv[i][1]) {
+		case 'o':
+		    if (++i >= argc) {
+			fprintf(stderr, "mimencode: -o requires a file name.\n");
+			exit(-1);
+		    }
+		    fpo = fopen(argv[i], "w");
+		    if (!fpo) {
+			perror(argv[i]);
+			exit(-1);
+		    }
+		    break;
+                case 'u':
+                    encode = 0;
+                    break;
+                case 'q':
+                    which = QP;
+                    break;
+                case 'p':
+                    portablenewlines = 1;
+                    break;
+                case 'b':
+                    which = BASE64;
+                    break;
+		default:
+                    fprintf(stderr,
+                       "Usage: %s [-u] [-q] [-b] [-p] [-o outputfile] [file name]\n", *argv);
+                    exit(-1);
+            }
+        } else {
+	  //#ifdef MSDOS
+	  //            if (encode)
+          //      fp = fopen(argv[i], "rb");
+          //  else
+          //  {
+          //      fp = fopen(argv[i], "rt");
+          //      setmode(fileno(fpo), O_BINARY);
+          //  } /* else */
+	  //#else
+            fp = fopen(argv[i], "r");
+	    //#endif /* MSDOS */
+            if (!fp) {
+                perror(argv[i]);
+                exit(-1);
+            }
+        }
+    }
+    //#ifdef MSDOS
+    //if (fp == stdin) setmode(fileno(fp), O_BINARY);
+    //#endif /* MSDOS */
+    if (which == BASE64) {
+        if (encode) {
+            to64(fp, fpo, portablenewlines);
+        } else {
+            from64(fp,fpo, (char **) NULL, (int *) 0, portablenewlines);
+        }
+    } else {
+        if (encode) toqp(fp, fpo); else fromqp(fp, fpo, NULL, 0);
+    }
+    return(0);
+}
+
--- metamail-2.7.orig/src/metamail/tmpfile.c
+++ metamail-2.7/src/metamail/tmpfile.c
@@ -0,0 +1,120 @@
+#include <metamail/common.h>
+#include <metamail/dlist.h> /* double linked list management */
+
+#include "tmpfile.h"
+#include "metamail.h"
+
+DList TmpNameList = { NULL, NULL };
+
+void
+MkTmpFileName(name)
+     char *name;
+{
+  int   tmpfd   = 0;
+
+  if (DoDebug) 
+    fprintf(stderr, "MkTmpFileName:\n");
+
+  if (!name) {
+    if (DoDebug)
+      fprintf(stderr, "name is null\nMkTmpFileName END\n");
+    return;
+  }
+  
+  strcpy(name, tmproot);
+  strcat(name, "/MXXXXXX");
+ 
+  if ((tmpfd = mkstemp(name)) > 0) {
+    if (close(tmpfd) == -1) {
+      metamail_warning( "couldn't close tmpfile: ", xstrerror( errno ) );
+      name[0] = 0;
+      return;
+    }
+    if (DoDebug)
+      fprintf(stderr, "name = \"%s\"\n", name);
+    AddTmpFileName( name );
+    if (DoDebug)
+      fprintf( stderr, "MkTmpFileName END\n", name);
+  } else {
+    metamail_warning( "couldn't optain tmpfile: ", xstrerror( errno ) );
+    return;
+  }
+}
+
+void
+AddTmpFileName(name)
+     char *name;
+{
+  char *tmpname = NULL;
+  if ( name ) {
+    tmpname = XMALLOC( char, strlen(name) + 1 );
+  
+    strcpy( tmpname, name );
+    dlist_insertnew( &TmpNameList, (void*) tmpname, TmpNameList.tail );
+    if (DoDebug)
+      fprintf( stderr, "AddTmpFileName: %s\n", name );
+  }
+}
+
+void
+DelTmpFileName(name)
+     char *name;
+{
+  DListEntry *help = NULL;
+  
+  if ( (help = dlist_remove( &TmpNameList, dlist_search( &TmpNameList, name, 
+							 dlist_strcmp ) ) ) ) {
+    XFREE( help->data );
+    XFREE( help );
+  } else
+    fprintf(stderr, "tried to remove non tmplist file %s\n", name);
+}
+
+void
+RmTmpFileName(name)
+     char *name;
+{
+  DListEntry* help = NULL;
+  
+  if (DoDebug) 
+    fprintf( stderr, "RmTmpFileName:\n" );
+
+  if( (help = dlist_remove( &TmpNameList, 
+			    dlist_search( &TmpNameList, name, 
+					  dlist_strcmp ) ) ) ) {
+    if (DoDebug) fprintf( stderr, "filename: %s\n", name );
+    if (!access( name, R_OK ) ) { 
+      if(unlink( name ) == -1)
+	metamail_error( stderr, "error unlinking: ", xstrerror( errno ) );
+    }
+    XFREE( help->data );
+    XFREE( help );
+  }
+}
+
+void
+CleanupTmpFiles( void )
+{
+  DListEntry* help = NULL;
+  
+  if (DoDebug) 
+    fprintf( stderr, "CleanupTmpFiles:\n" );
+
+  while ( TmpNameList.head ) {
+    if (DoDebug) fprintf(stderr, "tmpfile: %s  %X\n", TmpNameList.head->data,
+			 TmpNameList.head->next);
+    if (!access( (char*) TmpNameList.head->data, R_OK )) {
+      if (DoDebug) fprintf( stderr, "access file yes\n" );
+      if (unlink( (char*) TmpNameList.head->data ) < 0) {
+	if (DoDebug) 
+	  metamail_error( stderr, "error unlinking: ", 
+			  (char*) TmpNameList.head->data );
+      }
+    }
+    
+    help = dlist_remove( &TmpNameList, TmpNameList.head );
+    if (DoDebug) fprintf( stderr, "%X\n", help );
+    XFREE( help->data );
+    XFREE( help );
+  }
+}
--- metamail-2.7.orig/src/metamail/tmpfile.h
+++ metamail-2.7/src/metamail/tmpfile.h
@@ -0,0 +1,15 @@
+#ifndef METAMAIL_TMPFILE_H
+#define METAMAIL_TMPFILE_H 1
+
+/* create and remove tmpfiles */
+void MkTmpFileName( char* );
+void RmTmpFileName( char* );
+/* and cleanup after doing all kind of things */
+void CleanupTmpFiles( void );
+
+/* register and unregister tmpfiles */
+/* these functions should not be invoked directly (there are exceptions) */
+void AddTmpFileName( char* );
+void DelTmpFileName( char* );
+
+#endif /* METAMAIL_TMP_FILE_H */
--- metamail-2.7.orig/src/metamail/metamail.old
+++ metamail-2.7/src/metamail/metamail.old
@@ -0,0 +1,2756 @@
+/*
+Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
+
+Permission to use, copy, modify, and distribute this material 
+for any purpose and without fee is hereby granted, provided 
+that the above copyright notice and this permission notice 
+appear in all copies, and that the name of Bellcore not be 
+used in advertising or publicity pertaining to this 
+material without the specific, prior written permission 
+of an authorized representative of Bellcore.  BELLCORE 
+MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
+OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
+WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+*/
+/****************************************************** 
+    Metamail -- A tool to help diverse mail readers 
+                cope with diverse multimedia mail formats.
+
+    Author:  Nathaniel S. Borenstein, Bellcore
+
+ ******************************************************* */
+
+#include <stdio.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include "../config.h"
+#include <patchlevel.h>
+#include "dlist.h"
+
+#ifdef BORLAND
+#define F_OK 0
+extern unsigned _stklen = 16384;
+extern char *mktemp(char *);
+#define WRITE_BINARY	"w"
+#else /* BORLAND */
+#ifdef MICROSOFT
+#include <malloc.h>
+#include <stdlib.h>
+#include <time.h>
+#include <signal.h>
+#define F_OK 0
+#else
+#include <pwd.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#include <signal.h>
+#ifndef AMIGA
+#ifdef SYSV
+#include <termio.h>
+#include <unistd.h>
+#else /* SYSV */
+#include <sgtty.h>
+#endif /* SYSV */
+#endif /* AMIGA */
+#endif /* MICROSOFT */
+#endif /* BORLAND */
+
+#if defined(SYSV) && !defined(linux)
+#define LPRTEMPLATE "lp %s"
+#define LPRCOMMAND "lp"
+#else
+#define LPRTEMPLATE "lpr %s"
+#define LPRCOMMAND "lpr"
+#endif
+#ifdef MSDOS
+#define CATCOMMAND  "cat"
+#define CATTEMPLATE "cat %s"
+#define METAMAIL    "metamail"
+#define TMPFILE_NAME_SIZE   128
+#define MAX_FILE_NAME_SIZE 128
+#define WRITE_BINARY	"wb"
+#else /* MSDOS */
+#ifdef AMIGA
+extern char *MkRmScript();
+#ifndef F_OK
+#define F_OK (0)
+#endif
+#define CATCOMMAND  "Type"
+#define CATTEMPLATE "Type %s"
+#define METAMAIL    "metamail <*"
+#define TMPFILE_NAME_SIZE     50
+#define MAX_FILE_NAME_SIZE 256
+#define WRITE_BINARY	"w"
+#else /* AMIGA */
+extern char **environ, *gets();
+#define CATCOMMAND  "cat"
+#define CATTEMPLATE "cat %s"
+#define METAMAIL    "metamail"
+#define TMPFILE_NAME_SIZE   1000
+#define MAX_FILE_NAME_SIZE 1000
+#define WRITE_BINARY	"w"
+#endif /* AMIGA */
+#endif /* MSDOS */
+
+#ifndef NO_RLIMITS
+#include <sys/resource.h>
+#endif
+
+#define CMDSIZE 1200 /* Maximum size of command to execute */
+
+#define LINE_BUF_SIZE       2000
+#ifndef MICROSOFT
+extern char *malloc();
+extern char *realloc();
+#endif
+extern char *getenv();
+extern char *index();
+extern char *rindex();
+char fileToDelete[MAX_FILE_NAME_SIZE];
+
+char *FindParam();
+extern FILE *popen();
+static char *nomem = "Out of memory!";
+static char *mmversion = MM_VERSTRING;
+static char *NoAskDefault = "text,text/plain,text/richtext";
+static char *QuietDefault = CATCOMMAND;
+static char *tmproot="";
+
+struct MailcapEntry {
+    char *contenttype;
+    char *command;
+    char *testcommand;
+    int needsterminal;
+    int copiousoutput;
+    int needtofree;
+    char *label;
+    char *printcommand;
+};
+
+FILE *InputFP = NULL;
+
+int MightAskBeforeExecuting = 1,
+    DefinitelyNotTty = 0,
+    MustNotBeTty = 0,
+    MaybePageOutput = 0,
+    MustPageOutput = 0,
+    EatLeadingNewlines = 0,
+    PrintSomeHeaders = 1,
+    DoInBackground = 0,
+    Quiet = 0,
+    TransparentMode = 0,
+    DeleteSourceFileWhenDone = 0,
+    Is822Format = 1,
+    DoDebug = 0,
+    CParamsAlloced = 0,
+    CParamsUsed = 0,
+    YankMode = 0,
+    UsingStandardInput = 0,
+    PrintingMode = 0,
+    JustWriteFiles = 0,
+    ProcessingErrors = 0;
+
+char *ContentType = NULL,
+    *ContentEncoding = NULL,
+    *MailerName = "unknown",
+    *MailSubject = "Mail message",
+    *MailFrom = "unknown sender",
+    *MailSummary = "non-text mail message",
+    *mailheaders = NULL,
+    **CParams = NULL,
+    **CParamValues = NULL,
+    *JunkParameter = NULL;
+
+DList* TmpNameListTail;
+
+#define ENCODING_NONE 0
+#define ENCODING_BASE64 1
+#define ENCODING_QUOTEDPRINTABLE 2
+#define ENCODING_8BIT 3
+#define ENCODING_UUENCODE -1	/* non-standard */
+int EncodingCode = ENCODING_NONE;
+
+struct part {
+    char *ctype;
+    char *fname;
+    struct part *next;
+};
+
+struct NoAskItem {
+    char *type;
+    struct NoAskItem *next;
+} *FirstNoAskItem = NULL,
+  *FirstQuietItem = NULL;
+
+#ifdef MICROSOFT
+/* Need a function prototype for TryMailcapEntry because without it MSC
+ * passes a pointer to the structure rather than the structure itself.
+ */
+TryMailcapEntry(struct MailcapEntry mc, char *SquirrelFile);
+#endif
+
+void PrintHeader();
+void ConsumeRestOfPart();
+void ParseContentParameters();
+
+void CleanupTmpFiles();
+
+sigtype cleanup();
+
+char *Cleanse(s) /* no leading or trailing space, all lower case */
+char *s;
+{
+    char *tmp, *news;
+    
+    /* strip leading white space */
+    while (*s && isspace((unsigned char) *s)) ++s;
+    news = s;
+    /* put in lower case */
+    for (tmp=s; *tmp; ++tmp) {
+        if (isupper((unsigned char) *tmp)) *tmp = tolower((unsigned char) *tmp);
+    }
+    /* strip trailing white space */
+    while (tmp > news && *--tmp && isspace((unsigned char) *tmp)) *tmp = 0;
+    return(news);
+}
+
+char *UnquoteString(s)
+char *s;
+{
+    char *ans, *t;
+
+    if (*s != '"') return(s);
+    ans = malloc(1+strlen(s));
+    if (!ans) ExitWithError(nomem);
+    ++s;
+    t = ans;
+    while (*s) {
+        if (*s == '\\') {
+            *t++ = *++s;
+        } else if (*s == '"') {
+            break;
+        } else {
+            *t++ = *s;
+        }
+        ++s;
+    }
+    *t = 0;
+    return(ans);
+}
+
+sigtype
+cleanup(signum) 
+int signum;
+{
+    RestoreTtyState();
+#if defined(MSDOS) || defined(AMIGA)
+    exit(signum);
+#else
+    signal(signum, SIG_DFL);
+    kill(getpid(), signum);
+#endif
+}
+
+char **Boundaries = NULL;
+int BoundaryCt = 0, BoundaryAlloc = 0;
+struct nextfile {
+    char *filename;
+    struct nextfile *next;
+} *FileQueue=NULL, *LastInQueue = NULL;
+
+void
+ResetGlobals() {
+    CParamsAlloced = 0;
+    CParamsUsed = 0;
+
+    ContentType = NULL;
+    ContentEncoding = NULL;
+    MailSubject = "Mail message";
+    MailFrom = "unknown sender";
+    MailSummary = "non-text mail message";
+    mailheaders = getenv("MM_HEADERS");
+    if (mailheaders) {
+        char *s;
+        s = malloc(15+strlen(mailheaders));
+        if (!s) ExitWithError(nomem);
+        sprintf(s, "MM_HEADERS=%s", mailheaders);
+        mailheaders = s;
+    }
+    CParams = NULL;
+    CParamValues = NULL;
+    JunkParameter = NULL;
+}
+
+void modpath(auxpath)
+char *auxpath;
+{
+    if (auxpath && *auxpath) {
+        static char *newpath = 0;
+	char *oldpath = newpath;
+        char *path = getenv("PATH");
+
+	if (!path) path = "";	/* give a default if no current path */
+	newpath = malloc(7 + strlen(path) + strlen(auxpath));
+        if (!newpath) ExitWithError(nomem);
+        sprintf(newpath, "PATH=%s:%s", auxpath, path);
+        putenv(newpath);
+	if (oldpath) free(oldpath); 	/* free up any old allocated PATH */
+    }
+}
+
+main(argc, argv)
+int argc;
+char **argv;
+{
+    int retcode;
+
+    modpath(AUXPATH);
+#ifndef MSDOS
+    signal(SIGINT, cleanup);
+#ifndef AMIGA
+    signal(SIGILL, cleanup);
+    signal(SIGTRAP, cleanup);
+    signal(SIGIOT, cleanup);
+    signal(SIGFPE, cleanup);
+#ifndef linux
+    signal(SIGEMT, cleanup);
+    signal(SIGBUS, cleanup);
+#endif
+    signal(SIGSEGV, cleanup);
+    signal(SIGTERM, cleanup);
+#endif
+#endif
+#ifdef SIGXCPU
+    signal(SIGXCPU, cleanup);
+#endif
+    tmproot = getenv("METAMAIL_TMPDIR");
+    if (!tmproot) tmproot="/tmp";
+    mailheaders = getenv("MM_HEADERS");
+    if (mailheaders) {
+        char *s;
+        s = malloc(15+strlen(mailheaders));
+        if (!s) ExitWithError(nomem);
+        sprintf(s, "MM_HEADERS=%s", mailheaders);
+        mailheaders = s;
+    }
+    fileToDelete[0] = 0;
+    ProcessArguments(argc, argv); /* calls ExitWithError on error */
+#if !defined(AMIGA) && !defined(MSDOS)
+    if (MaybePageOutput) {
+        /* Want to send stderr to pager too, sigh... */
+        fflush(stderr);
+        close(2);
+        dup2(1, 2);
+    }
+#endif
+    retcode = HandleMessage(NULL, 0);
+    if (! UsingStandardInput) {
+        fclose(InputFP);
+    }
+    if (fileToDelete[0]) {
+        unlink(fileToDelete);
+        fileToDelete[0] = 0;
+    }
+    while (FileQueue) {
+        InputFP = fopen(FileQueue->filename, "r");
+        if (DoDebug) printf("Trying to open input file: %s\n", FileQueue->filename);
+        if (!InputFP) ExitWithError("Can't read input file");
+        if (DeleteSourceFileWhenDone) {
+            strcpy(fileToDelete, FileQueue->filename);
+        }
+        ResetGlobals();
+        retcode |= HandleMessage(NULL, 0);
+        if (! UsingStandardInput) {
+            fclose(InputFP);
+        }
+        if (fileToDelete[0]) {
+            unlink(fileToDelete);
+            fileToDelete[0] = 0;
+        }
+        FileQueue = FileQueue->next;
+    }
+    if (MustPageOutput) PauseForUser();
+    CleanupTmpFiles();
+    exit(ProcessingErrors? -1 : retcode);
+}
+
+void
+QueueNextFile(fname)
+char *fname;
+{
+    struct nextfile *tmp = (struct nextfile *) malloc(sizeof (struct nextfile));
+    if (!tmp) ExitWithError(nomem);
+    tmp->filename = fname;
+    tmp->next = NULL;
+    if (FileQueue) {
+        LastInQueue->next = tmp;
+        LastInQueue = tmp;
+    } else {
+        FileQueue = tmp;
+        LastInQueue = tmp;
+    }
+}
+
+HandleMessage(SquirrelFile, nestingdepth)
+char *SquirrelFile;
+/* SquirrelFile, if non-NULL, is a place to save a recognized body instead of executing it. */
+int nestingdepth;
+{
+    char *boundary;
+    int FileWriteOnly = JustWriteFiles;
+
+    if (FileWriteOnly) {
+        if (!lc2strncmp(ContentType, "message/", 8)
+             || !lc2strncmp(ContentType, "multipart/", 10)) {
+            FileWriteOnly = 0; /* only leaf data */
+        }
+    }
+    if (Is822Format) {
+	if (Read822Prefix(SquirrelFile?0:1, nestingdepth)) {
+	    return -1;
+	}
+    } else Is822Format = 1; /* this property is not recursive for multipart or message */
+    PrepareMessage();
+    if (!FileWriteOnly && !ProcessMailcapFiles(SquirrelFile)) return(0);
+    if (!lc2strcmp(ContentType, "message")
+         || !lc2strcmp(ContentType, "message/rfc822")) { 
+        if (SquirrelFile) return(SaveSquirrelFile(SquirrelFile));
+        ContentType = NULL; /* reset default */
+        ContentEncoding = NULL; /* reset default */
+        return(HandleMessage(NULL, nestingdepth+1)); /* simple recursion */
+    }
+    boundary = FindParam("boundary");
+    if (!boundary) boundary =JunkParameter; /* backward compatibility hack */
+    if (!lc2strncmp(ContentType, "multipart", 9)) { 
+      if (!boundary) {
+	  fprintf(stderr, "Warning: No boundary for multipart data, treating as unrecognized format.\n");
+      } else {
+        char *LineBuf, NewSquirrelFile[TMPFILE_NAME_SIZE];
+        char *subtype = NULL;
+        int currct, result, IsAlternative, WroteSquirrelFile, boundarylen;
+
+        if (SquirrelFile) return(SaveSquirrelFile(SquirrelFile));
+        if (boundary[0] == '"') {
+            boundary=UnquoteString(boundary);
+        }
+        subtype = index(ContentType, '/');
+        if (subtype) {
+            ++subtype;
+            subtype = Cleanse(subtype);
+        } else subtype = "mixed";
+#ifndef MSDOS
+        if (!MaybePageOutput && !DoInBackground) DoInBackground = strcmp(subtype, "parallel") ? 0 : 1;
+#endif
+
+        IsAlternative = strcmp(subtype, "alternative") ? 0 : 1;
+        if (IsAlternative) {
+            MkTmpFileName(NewSquirrelFile);
+            WroteSquirrelFile = 0;
+        }
+        LineBuf = malloc(LINE_BUF_SIZE);
+        if (!LineBuf) ExitWithError(nomem);
+        sprintf(LineBuf, "--%s", boundary);
+        strcpy(boundary, LineBuf);
+        boundarylen = strlen(boundary);
+        if (BoundaryCt >= BoundaryAlloc) {
+            BoundaryAlloc += 5;
+            if (Boundaries) {
+                Boundaries = (char **) realloc(Boundaries, BoundaryAlloc*sizeof(char *));
+            } else {
+                Boundaries = (char **) malloc(BoundaryAlloc*sizeof(char *));
+            }
+            if (!Boundaries) ExitWithError(nomem);
+        }
+        Boundaries[BoundaryCt++] = boundary;
+        if (DoDebug) printf("Handling multipart as built-in here.  Boundary: %s\n", boundary);
+        while (fgets(LineBuf, LINE_BUF_SIZE, InputFP)) { /* find start */
+            if (!strncmp(LineBuf, boundary, boundarylen)
+                 && ((LineBuf[boundarylen] == '\n')
+                      || (LineBuf[boundarylen] == '-'
+                           && LineBuf[boundarylen+1] == '-'
+                           && LineBuf[boundarylen+2] == '\n'))) {
+                break;
+            }
+        }
+        free(LineBuf);
+        currct = BoundaryCt;
+        while(currct == BoundaryCt) {
+            if (!strcmp(subtype, "digest")) {
+                ContentType = "message/rfc822";
+            } else {
+                ContentType = NULL; /* reset default */
+            }
+            ContentEncoding = NULL; /* reset default */
+            if (IsAlternative) {
+                result = HandleMessage(NewSquirrelFile, nestingdepth+1);
+            } else{
+                result = HandleMessage(NULL, nestingdepth+1);
+            }
+            if (result) {
+                /* Need to consume the rest of the part */
+                ConsumeRestOfPart(NULL);
+            } else {
+                ++WroteSquirrelFile;
+            }
+        }
+        /* Now we've seen the last encapsulation boundary, but if there is a "postfix"
+            we must throw it away.*/
+        if (BoundaryCt > 0) {
+            ConsumeRestOfPart(NULL);
+        }
+        if (IsAlternative) {
+            if (WroteSquirrelFile) {
+                int retcode; 
+                char Cmd[TMPFILE_NAME_SIZE + 15];
+                sprintf(Cmd, "%s %s", METAMAIL, NewSquirrelFile);
+                fflush(stdout); fflush(stderr);
+                retcode = system(Cmd);
+#ifdef MSDOS
+                retcode = 0;
+#endif
+                unlink(NewSquirrelFile);
+                return(retcode);
+            } else {
+                printf("Cannot handle any part of multipart/alternative message\n");
+            }
+        }
+	return(0);
+      }
+    } /* End of multipart handling */
+    if (!FileWriteOnly && !TryBuiltIns(SquirrelFile)) return(0);
+    if (!SquirrelFile) { /* Very last resort -- unrecognized types */
+        char Fname[MAX_FILE_NAME_SIZE], *suggestedname, SugBuf[MAX_FILE_NAME_SIZE];
+        FILE *fp;
+        int ans = 0, octetstream, ecode=0;
+        suggestedname = FindParam("name");
+        if (!suggestedname) {
+            MkTmpFileName(SugBuf);
+            suggestedname = SugBuf;
+        } else if (suggestedname[0] == '"') {
+            suggestedname=UnquoteString(suggestedname);
+        }
+        octetstream = ! lc2strcmp(ContentType, "application/octet-stream");
+        if (MightAskBeforeExecuting
+             && !DefinitelyNotTty && !MustNotBeTty) {
+            if (FileWriteOnly) {
+                printf("\nThis message contains '%s`-format data.\n", ContentType);
+            } else if (octetstream) {
+                printf("This message contains raw digital data, which can either be viewed as text\nor written to a file.\n");
+            } else {
+                printf("\nThis message contains data in an unrecognized format, %s,\nwhich can either be viewed as text or written to a file.\n", ContentType);
+            }
+            while (!ans) {
+                if (FileWriteOnly) {
+                    ans = 2;
+                } else {
+                    printf("\nWhat do you want to do with the %s data?\n1 -- See it as text\n2 -- Write it to a file\n3 -- Just skip it\n\n", octetstream ? "raw" : ContentType);
+                    fgets(Fname, sizeof(Fname), stdin);
+                    ans = atoi(Fname);
+                }
+                switch(ans) {
+                    case 1:
+                        TranslateInputToOutput(InputFP, stdout, EncodingCode, "text");
+                        return(0);
+                    case 2:
+                        {
+                        int needname = 1;
+                        while (needname) {
+                            needname = 0;
+                            printf("Please enter the name of a file to which the data should be written\n(Default: %s) > ", suggestedname);
+                            fflush(stdout);
+                            fgets(Fname, sizeof(Fname), stdin);
+                            Fname[strlen(Fname) - 1] = '\0'; /* bogus newline */
+#if !defined(AMIGA) && !defined(MSDOS)
+                            if (!Fname[0]) strcpy(Fname, suggestedname);
+                            if (Fname[0] == '~' && Fname[1] == '/') {
+                                char Fname2[1000];
+                                int uid = getuid();
+                                struct passwd *p;
+                                p = getpwuid(uid);
+                                if (!p) {
+                                    MkTmpFileName(Fname);
+                                    printf("Cannot figure out what ~ means, using temporary file %s instead\n", Fname);
+                                } else {
+                                    strcpy(Fname2, p->pw_dir);
+                                    strcat(Fname2, "/");
+                                    strcat(Fname2, Fname + 2);
+                                    strcpy(Fname, Fname2);
+                                }
+                            }
+#endif
+                            if (access(Fname, F_OK) == 0) {
+                                char *s, AnsBuf[50];
+                                int overwriteans = -1;
+                                do {
+                                    printf("File %s exists.  Do you want to overwrite it (y/n) ?\n", Fname);
+                                    s = fgets(AnsBuf, sizeof(AnsBuf), stdin);
+                                    if (!s) {
+                                        overwriteans = 0;
+                                    } else {
+                                        while (s && *s && isspace((unsigned char) *s)) ++s;
+                                        if (*s == 'y' || *s == 'Y' || !*s || *s == '\n') {
+                                            overwriteans = 1;
+                                        } else if (*s == 'n' || *s == 'N' || *s == 'q' || *s == 'Q') {
+                                            overwriteans=0;
+                                        }
+                                    }
+                                    if (overwriteans == -1) printf("Please answer yes or no.\n");
+                                } while (overwriteans == -1);
+                                if (overwriteans == 0) needname = 1;
+                            }
+                        }
+                        }
+                        break;
+                    case 3:
+                        ConsumeRestOfPart(NULL);
+                        return(0);
+                        break;
+                    default:
+                        ans = 0;
+                        break;
+                }
+            }
+        } else {
+            int ct = 0;
+            char *slash = rindex(suggestedname, '/');
+#ifdef AMIGA
+	    if (slash == NULL) {
+                slash = rindex(suggestedname, ':');
+            }
+#endif
+            if (slash)  {
+                ++slash;
+            } else {
+                slash = suggestedname;
+            }
+            do {
+                if (ct) {
+#ifdef AMIGA
+                    sprintf(Fname, "T:%d-%s", ct, slash);
+                } else {
+                    sprintf(Fname, "T:%s", slash);
+#else
+                    sprintf(Fname, "%s/%d-%s", tmproot, ct, slash);
+                } else {
+                    sprintf(Fname, "%s/%s", tmproot, slash);
+#endif
+                }
+                ++ct;
+            } while (access(Fname, F_OK) == 0);
+            if (FileWriteOnly) {
+                printf("\nThis message contains '%s`-format data.\n", ContentType);
+            } else if (octetstream) {
+                printf("\nThis message contains raw digital data,");
+            } else {
+                printf("\nThis message contains data in an unrecognized format, %s,", ContentType);
+            }
+            printf("\nwhich is being decoded and written to the file named \"%s\".\nIf you do not want this data, you probably should delete that file.\n", Fname);
+        }
+        if (Fname[0] == 0 || Fname[0] == '\n') {
+            ConsumeRestOfPart(NULL);
+        } else {
+            fp = fopen(Fname, WRITE_BINARY);
+            if (!fp) ExitWithError("Cannot open temporary file");
+            TranslateInputToOutput(InputFP, fp, EncodingCode, ContentType);
+            ecode = fclose(fp);
+            if (ecode) {
+                printf("Could not write file %s\n", Fname);
+            } else {
+                printf("Wrote file %s\n", Fname);
+            }
+        }
+        if (!DefinitelyNotTty && MaybePageOutput && BoundaryCt > 0) PauseForUser();
+        return(ecode);
+    }
+    return(-1); /* Unrecognized, really */
+}
+
+ProcessArguments(argc, argv)
+int argc;
+char **argv;
+{
+    int i, RunAsRootOK = 0;
+    char *SourceFileName = NULL, *NoAskStr, *QuietStr;
+
+    QuietStr = getenv("MM_QUIET");
+    if (!QuietStr) {
+        QuietStr=QuietDefault;
+    }
+    if (!strcmp(QuietStr, "1")) {
+        Quiet = 1;
+    } else {
+        struct NoAskItem *qitem;
+        char *s, *tmp;
+        char *QuietCopy;
+
+        Quiet = 0;
+        QuietCopy = malloc(1+strlen(QuietStr));
+        if (!QuietCopy) ExitWithError(nomem);
+        strcpy(QuietCopy, QuietStr);
+        for (tmp=QuietCopy; *tmp; ++tmp) {
+            if (isupper((unsigned char) *tmp)) *tmp = tolower((unsigned char) *tmp);
+        }
+        do {
+            s = index(QuietCopy, ',');
+            if (s) *s++ = 0;
+            qitem = (struct NoAskItem *) malloc(sizeof (struct NoAskItem));
+            if (!qitem) ExitWithError(nomem);
+            qitem->next = FirstQuietItem;
+            qitem->type = QuietCopy;
+            FirstQuietItem = qitem;
+            QuietCopy = s;
+        } while (QuietCopy);
+    }
+    if (getenv("MM_TRANSPARENT")) {
+        TransparentMode = atoi(getenv("MM_TRANSPARENT")); /* Will not propogate recursively */
+    }
+    if (getenv("MM_RUNASROOT")) {
+        RunAsRootOK = atoi(getenv("MM_RUNASROOT"));
+    }
+    if (getenv("MM_YANKMODE")) {
+        YankMode = atoi(getenv("MM_YANKMODE")); /* Will not propogate recursively */
+    }
+    if (getenv("MM_DEBUG")) {
+        DoDebug = atoi(getenv("MM_DEBUG"));
+    }
+    if (DoDebug) printf("Metamail Version %s, debugging turned on.\n", mmversion);
+    NoAskStr = getenv("MM_NOASK");
+    if (!NoAskStr) NoAskStr = NoAskDefault;
+    if (!strcmp(NoAskStr, "1")) {
+        MightAskBeforeExecuting = 0;
+    } else {
+        struct NoAskItem *nai;
+        char *s, *tmp;
+        char *NoAskCopy;
+
+        NoAskCopy = malloc(1+strlen(NoAskStr));
+        if (!NoAskCopy) ExitWithError(nomem);
+        strcpy(NoAskCopy, NoAskStr);
+        for (tmp=NoAskCopy; *tmp; ++tmp) {
+            if (isupper((unsigned char) *tmp)) *tmp = tolower((unsigned char) *tmp);
+        }
+        do {
+            s = index(NoAskCopy, ',');
+            if (s) *s++ = 0;
+            nai = (struct NoAskItem *) malloc(sizeof (struct NoAskItem));
+            if (!nai) ExitWithError(nomem);
+            nai->next = FirstNoAskItem;
+            nai->type = NoAskCopy;
+            FirstNoAskItem = nai;
+            NoAskCopy = s;
+        } while (NoAskCopy);
+    }
+    MailerName = getenv("MM_MAILER");
+    if (!MailerName) MailerName = "unknown";
+    if (getenv("MM_USEPAGER")) {
+        MaybePageOutput = atoi(getenv("MM_USEPAGER"));
+    }
+    if ((getenv("MM_NOTTTY") && ((atoi(getenv("MM_NOTTTY"))) != 0))) {
+        MustNotBeTty = 1;
+    }
+    if (MustNotBeTty
+         || !isatty(0)
+         || !isatty(1)) {
+        DefinitelyNotTty = 1;
+    }
+    for (i=1; i<argc; ++i) {
+	if (argv[i][0] == '-') {
+	    switch (argv[i][1]) {
+		case '\0':
+		    /* Not really necessary, but.... */
+		    SourceFileName = NULL;
+		    UsingStandardInput = 1;
+		    break;
+		case 'b':
+		    Is822Format = 0;
+		    break;
+		case 'B':
+#ifdef MSDOS
+                    fprintf(stderr, "metamail warning: -B flag not supported on this system\n");
+#else
+		    DoInBackground = 1;
+#endif
+		    break;
+                case 'c':
+		    if (++i >= argc) usage();
+		    ContentType = malloc(1+strlen(argv[i]));
+		    if (!ContentType) ExitWithError(nomem);
+                    strcpy(ContentType,argv[i]);
+                    /* strip leading white space */
+                    while (*ContentType && isspace((unsigned char) *ContentType)) ++ContentType;
+                    StripTrailingSpace(ContentType);
+                    ParseContentParameters(ContentType);
+                    break;
+                case 'd':
+		    MightAskBeforeExecuting = 0;
+		    break;
+		case 'e':
+		    EatLeadingNewlines = 1;
+		    break;
+		case 'E':
+		    if (++i >= argc) usage();
+		    ContentEncoding = argv[i];
+		    break;
+		case 'f':
+		    if (++i >= argc) usage();
+		    MailFrom = argv[i];
+                    break;
+                case 'h':
+                    {
+                    FILE *tmpfp;
+                    PrintingMode = 1;
+                    MightAskBeforeExecuting = 0;
+#ifdef AMIGA
+		    freopen("prt:", "w", stdout);
+#else
+                    /* Want to make all of stdout go to printer, and this 
+                      is easier than changing every output statement,
+                      at least on UNIX... */
+                    tmpfp = popen(LPRCOMMAND, "w");
+                    if (!tmpfp) {
+                        ExitWithError("Cannot execute lpr command");
+                    }
+                    fflush(stdout);
+                    close(1);
+                    dup2(fileno(tmpfp), 1);
+#endif
+                    break;
+                    }
+		case 'm':
+		    if (++i >= argc) usage();
+		    MailerName = argv[i];
+		    break;
+		case 'p':
+		    MaybePageOutput = 1;
+		    break;
+		case 'P':
+                    MaybePageOutput = 1;
+                    MustPageOutput = 1;
+		    break;
+		case 'r':
+#ifdef MSDOS
+                    fprintf(stderr, "metamail warning: -r flag not supported on this system\n");
+#else
+		    RunAsRootOK = 1;
+#endif
+                    break;
+                case 'R':
+#ifdef RESET_PROGRAM
+                    system(RESET_PROGRAM);
+                    if (DoDebug) printf("Executed reset\n");
+#else
+                    fprintf(stderr, "metamail warning: -R flag not supported on this system\n");
+#endif
+                    break;
+		case 's':
+		    if (++i >= argc) usage();
+		    MailSubject = argv[i];
+		    break;
+                case 'T':
+                    TransparentMode = 0;
+                    break;
+                case 'w':
+                    JustWriteFiles = 1;
+                    break;
+                case 'q':
+                    Quiet = 1;
+		    PrintSomeHeaders = 0;
+		    break;
+		case 'x':
+                    DefinitelyNotTty = 1;
+                    MustNotBeTty = 1;
+		    break;
+                case 'y':
+                    YankMode = 1;
+                    break;
+		case 'z':
+		    DeleteSourceFileWhenDone = 1;
+		    break;
+		default:
+		    usage();
+	    }
+	} else {
+	    if (SourceFileName) {
+                QueueNextFile(argv[i]);
+	    } else {
+		SourceFileName = argv[i];
+	    }
+	}
+    }
+    if (TransparentMode) {
+        RunInNewWindow(argv, argc, &SourceFileName);
+    }
+    if (MaybePageOutput && DoInBackground) {
+	MustNotBeTty = 1;
+        /*fprintf(stderr, "metamail: -B is incompatible with -p, -P, and MM_USEPAGER\n");
+        usage(); */
+    }
+    if (!Is822Format && !ContentType) {
+	fprintf(stderr, "metamail:  -b requires -c.\n");
+	usage();
+    }
+    if (DeleteSourceFileWhenDone && !SourceFileName) {
+	fprintf(stderr, "metamail:  -z requires -f.\n");
+	usage();
+    }
+#if !defined(AMIGA) && !defined(MSDOS)
+    if (!RunAsRootOK && (getuid() == 0 || geteuid() == 0)) {
+	fprintf(stderr, "You can not run MetaMail as root unless you use -r or set MM_RUNASROOT.\n");
+	usage();
+    }
+#endif
+    if (SourceFileName) {
+        InputFP = fopen(SourceFileName, "r");
+        if (DoDebug) printf("Trying to open input file: %s\n", SourceFileName);
+        if (!InputFP) ExitWithError("Can't read input file");
+        if (DeleteSourceFileWhenDone) {
+            strcpy(fileToDelete, SourceFileName);
+        }
+    } else {  /* input on stdin */
+        UsingStandardInput = 1;
+        if (MustNotBeTty) {
+            InputFP = stdin;
+/*            MaybePageOutput = 1; */ /* This messed up safe-tcl -- nsb 9/21/93 */
+            MightAskBeforeExecuting = 0;
+        } else {
+#if defined(MSDOS) || defined(AMIGA)
+            InputFP = stdin;
+            DefinitelyNotTty = 1;
+            MaybePageOutput = 0;
+#else
+            int newfd = dup(0);
+            FILE *newfp;
+            if (newfd > 0) {
+                InputFP = fdopen(newfd, "r");
+                if (InputFP 
+                     && ((newfp = fopen("/dev/tty", "r")) != NULL)
+                     && !dup2(fileno(newfp), 0)) {
+                    DefinitelyNotTty = 0;
+                } else {
+                    InputFP = stdin;
+                    DefinitelyNotTty = 1;
+                    MaybePageOutput = 0;
+                }
+            }
+#endif
+        }
+    }
+    if (DefinitelyNotTty && MaybePageOutput) {
+        RunInNewWindow(argv, argc, &SourceFileName);
+    }
+    if (DefinitelyNotTty) {
+        MaybePageOutput = 0;	/* Disable pager if I/O has been redirected */
+    }
+    return(0);
+}
+
+usage() {
+    fprintf(stderr, "Usage:  metamail [-b] [-B] [-d] [-e] [-h] [-r] [-R] [-p]  [-P] [-x] [-y] [-z] [-c content-type] [-E content-transfer-encoding] [-f from-name] [-m mailername] [-s subject] [message-file-name]\n");
+    ExitWithError(NULL);
+}
+
+RunInNewWindow(argv, argc, SourceFileNamePtr)
+char **argv, **SourceFileNamePtr;
+int argc;
+{
+    char *FullCmd, TmpName[TMPFILE_NAME_SIZE];
+    int i, createdfile=0;
+    if (!*SourceFileNamePtr) {
+        char *LineBuf;
+        FILE *fptmp;
+
+        LineBuf = malloc(LINE_BUF_SIZE);
+        if (!LineBuf) ExitWithError(nomem);
+        /* Create it, ugh.  Also needs to affect later command. */
+        MkTmpFileName(TmpName);
+        DeleteSourceFileWhenDone = 1;
+        fptmp = fopen(TmpName, WRITE_BINARY);
+        if (!fptmp) ExitWithError("Can't open temporary file\n");
+        while (fgets(LineBuf, LINE_BUF_SIZE, stdin)) {
+            fputs(LineBuf, fptmp);
+        }
+        free(LineBuf);
+        fclose(fptmp);
+        *SourceFileNamePtr = TmpName;
+        createdfile = 1;
+    }
+    FullCmd = malloc(CMDSIZE);
+    if (!FullCmd) ExitWithError(nomem);
+    if (TransparentMode) {
+        /* In transparent mode, we want to produce stdout that is what we get in, and do EVERYTHING externally in a terminal window.  This is to make the truly brain-dead mailers like mailtool happy. I am NOT happy about having to do this.  */
+        /* So, first we copy everything to stdout */
+        sprintf(FullCmd, CATTEMPLATE, *SourceFileNamePtr);
+        system(FullCmd); /* Cheesy way to do it */
+        fflush(stdout); fflush(stderr);
+    }
+    /* Then we run ourselves in a terminal window */
+    MailSummary = "Metamail"; /* for window label */
+    CreateNewWindowPrefix(FullCmd);
+    strcat(FullCmd, METAMAIL);
+    strcat(FullCmd, " -P ");
+    if (TransparentMode) strcat(FullCmd, "-T ");
+    for (i=1; i<argc; ++i) {
+        if (strncmp(argv[i], "-x", 2)
+             && strncmp(argv[i], "-B", 2)
+             && strncmp(argv[i], "-d", 2)) {
+            strcat(FullCmd, "\"");
+            strcat(FullCmd, argv[i]);
+            strcat(FullCmd, "\" ");
+        }
+    }
+    if (createdfile) {
+        strcat(FullCmd, "-z ");
+        strcat(FullCmd, *SourceFileNamePtr);
+    }
+    if (!MightAskBeforeExecuting) {
+        strcat(FullCmd, " -d ");
+        /* The special hack for -d is HORRIBLE, but xterm screws up with the -d option in the middle of the command line! */
+    }
+    if (DoInBackground) strcat(FullCmd, " &");
+    DefinitelyNotTty = 0;
+    SetUpEnvironment();
+    if (DoDebug) fprintf(stderr, "Executing %s\n", FullCmd);
+    fflush(stdout); fflush(stderr);
+#ifdef MSDOS
+    system(FullCmd);
+    exit(0);	/* system() returns random number under MS-DOS */
+#else
+    exit(system(FullCmd));
+#endif
+}
+
+/* Only one or the other set up builtins gets used,
+  depending on whether or not we're in the middle of 
+          a multipart/alternative body part */
+struct MailcapEntry BuiltIns[] = {
+    {"text/*", CATTEMPLATE, NULL, 0, 1, 0, "plain text", LPRTEMPLATE},
+    {NULL, NULL, NULL, 0, 0, 0}};
+
+struct MailcapEntry BuiltInsAlternative[] = {
+    {"text/plain", CATTEMPLATE, NULL, 0, 1, 0, "plain text", LPRTEMPLATE},
+    {NULL, NULL, NULL, 0, 0, 0}};
+
+ProcessMailcapFiles(SquirrelFile) 
+char *SquirrelFile;
+{
+    char *s, *pathcopy = NULL;
+#ifdef MICROSOFT
+    /* For the Microsoft compiler, we use the library function _searchenv
+     * to find the mailcap file.  It will search all the directories
+     * listed in the given environment variable (PATH in this case), then
+     * construct a path to the file if it finds it.
+     */
+    /* BOGUS -- this only finds the FIRST mailcap file, we want ALL mailcap files */
+    char path[128];
+
+    _searchenv("mailcap", "PATH", path);
+    if (path[0])
+        if (!ProcessMailcapFile(path, SquirrelFile)) return(0);
+    return(-1);
+#else /* MICROSOFT */
+#ifdef BORLAND
+    char *path = getenv("MAILCAPS");
+    if (!path)
+       path = STDPATH;
+#else /* BORLAND */
+#ifdef AMIGA
+    char *path = STDPATH;
+#else /* AMIGA */
+    char *path = getenv("MAILCAPS");
+    if (!path) {
+        int uid = getuid();
+        struct passwd *p;
+        p = getpwuid(uid);
+        if (p) path = malloc(5+strlen(p->pw_dir) + sizeof(STDPATH));
+        if (!p || !path) ExitWithError(nomem);
+        strcpy(path, p->pw_dir);
+        strcat(path, STDPATH);
+        pathcopy = path;
+    } else 
+#endif /* AMIGA */
+#endif /* BORLAND */
+    {
+        pathcopy = malloc(1+strlen(path));
+        if (!pathcopy) ExitWithError(nomem);
+        strcpy(pathcopy, path);
+        path = pathcopy;
+    }
+    while(path) {
+        s = index(path, PATH_SEPARATOR);
+        if (s) *s++ = 0;
+        if (!ProcessMailcapFile(path, SquirrelFile)) return(0);
+        path = s;
+    }
+    if (pathcopy) free(pathcopy);
+    return(-1);
+#endif /* MICROSOFT */
+}
+
+TryBuiltIns(SquirrelFile) 
+char *SquirrelFile;
+{
+    int i;
+    /* Last resort -- for sites that didn't bother putting a "text" line in their mailcap files... */
+    if (DoDebug) fprintf(stderr, "Looking for '%s' in built-in content-type handling settings.\n", ContentType);
+    for (i=0; BuiltIns[i].contenttype; ++i) {
+        if (!TryMailcapEntry(SquirrelFile ? BuiltInsAlternative[i] : BuiltIns[i], SquirrelFile))    return(0);
+    }
+    return(-1);
+}
+
+ProcessMailcapFile(file, SquirrelFile)
+char *file, *SquirrelFile;
+{
+    struct MailcapEntry mc;
+    FILE *fp;
+    int res;
+
+    res = IsDirectory(file);
+    if (res) {
+	if (res == 1) {
+	    fprintf(stderr, "Mailcap path entry '%s' is a directory, should be a readable file.\n", file);
+	} else if (DoDebug) {
+	/* Quietly ignore non-existent mailcap files unless debugging */
+	    fprintf(stderr, "Mailcap path entry '%s' does not exist.\n", file);
+	}
+	return(-1);
+    }
+    fp = fopen(file, "r");
+    if (DoDebug) fprintf(stderr, "Looking for '%s' in mailcap file '%s'.\n", ContentType, file);
+    while (fp && !feof(fp)) {
+        mc.needtofree = 0;
+	if (GetMailcapEntry(fp, &mc)) {
+            if (!TryMailcapEntry(mc, SquirrelFile)) {
+                fclose(fp);
+                return(0);
+            }
+	}
+    }
+    if (fp) fclose(fp);
+    return(-1);
+}
+
+static char *ThingsToSkip[] = {
+    "csh ",
+    "sh ",
+    "ksh ",
+    NULL
+};
+
+char *ShortCommand(progname)
+char *progname;
+{
+    int i;
+    char *s, *oldprogname;
+    static char FullProgName[500];
+
+eatmore:
+    while (*progname && (*progname == '(' || isspace((unsigned char) *progname))) {
+        ++progname;
+    }
+    oldprogname = progname;
+    for (i = 0; oldprogname == progname && ThingsToSkip[i]; ++i) {
+        if (!strncmp(progname, ThingsToSkip[i], strlen(ThingsToSkip[i]))) {
+            progname += strlen(ThingsToSkip[i]);
+        }
+    }
+    if (*progname == '-') {
+        ++progname;
+        while (*progname && !isspace((unsigned char) *progname)) ++progname;
+    }
+    if (progname != oldprogname) goto eatmore;
+    strcpy(FullProgName, progname);
+    s = index(FullProgName, ' ');
+    if (s) *s = 0;
+    s = rindex(FullProgName, '/');
+    if (s) {
+	return(s+1);
+    } else {
+	return(FullProgName);
+    }
+}    
+
+TryMailcapEntry(mc, SquirrelFile)
+struct MailcapEntry mc;
+char *SquirrelFile;
+{
+    StripTrailingSpace(mc.contenttype);
+    if (DoDebug) fprintf(stderr, "Trying mailcap entry for '%s'.\n", mc.contenttype);
+    if (PrintingMode && !mc.printcommand) return(-1);
+    if (CtypeMatch(ContentType, mc.contenttype) && PassesTest(&mc)) {
+        if (SquirrelFile) {
+            return(SaveSquirrelFile(SquirrelFile));
+        } else {
+            char TmpFileName[TMPFILE_NAME_SIZE];
+            MkTmpFileName(TmpFileName);
+            return(ExecuteMailcapEntry(mc, TmpFileName, ContentType));
+        }
+    }
+    if (mc.needtofree) {
+        free(mc.contenttype);
+        free(mc.command);
+    }
+    return(-1);
+}
+
+SaveSquirrelFile(SquirrelFile)
+char *SquirrelFile;
+{
+    int j;
+    FILE *outfp;
+
+    if (DoDebug) printf("saving to file %s\n", SquirrelFile);
+
+    outfp = fopen(SquirrelFile, WRITE_BINARY);
+    if (!outfp) {
+        fprintf(stderr, "Cannot open %s to squirrel away a portion of a multipart/alternative\n", SquirrelFile);
+        return(-1);
+    }
+    fprintf(outfp, "Content-type: %s", ContentType);
+    for (j=0; j<CParamsUsed; ++j) {
+        fprintf(outfp, " ; ");
+        fprintf(outfp, CParams[j]);
+        fprintf(outfp, " = ");
+        fprintf(outfp, CParamValues[j]);
+    }
+    fprintf(outfp, "\n\n"); 
+    TranslateInputToOutput(InputFP, outfp, EncodingCode, ContentType);
+    if (fclose(outfp)) {
+        ExitWithError("fclose failed");
+    }
+    return(0);
+}
+
+ExecuteMailcapEntry(mc, TmpFileName, ThisContentType)
+char *TmpFileName, *ThisContentType;
+struct MailcapEntry mc;
+{
+    int resultcode=0, DidExecute, UsedTmpFileName;
+    struct part *PartsWritten=NULL;
+    char *s, *cmd;
+
+    cmd = malloc(CMDSIZE);
+    if (!cmd) ExitWithError(nomem);
+    if (PrintingMode && !mc.printcommand) return(-1);
+    BuildCommand(cmd, PrintingMode ? mc.printcommand : mc.command, TmpFileName, &UsedTmpFileName, &PartsWritten);
+    if (DoDebug) fprintf(stderr, "Match!  Built command %s.\n", cmd);
+    if (mc.copiousoutput && MaybePageOutput) {
+        strcat(cmd, " | ");
+        s = getenv("METAMAIL_PAGER");
+        if (s && strncmp(s, "metamail", 8)) {
+            /* If METAMAIL_PAGER is set to "metamail" we override it */
+            strcat(cmd, s);
+#ifndef AMIGA
+            if (!strncmp(s, "less", 4) && strncmp(s+5, "-r", 2)) {
+                fprintf(stderr, "Warning:  'less' without '-r' behaves badly for some mail types,\n\tnotably richtext.\n");
+            }
+#endif
+        } else {
+            strcat(cmd, "more");
+        }
+    }
+    if (!DefinitelyNotTty) {
+        SaveTtyState();
+    }
+    if (!NeedToAskBeforeExecuting(ThisContentType)
+         || OKToRun(ThisContentType, cmd, mc.label)) {
+        char *FullCmd;
+        int ReallyNotTty;
+#ifndef NO_RLIMITS
+        /* Limit size of core dumps */
+        struct rlimit rlp;
+
+        rlp.rlim_cur = 0;
+        rlp.rlim_max = 0;
+        setrlimit(RLIMIT_CORE, &rlp); 
+#endif
+        FullCmd = malloc(CMDSIZE);
+        if (!FullCmd) ExitWithError(nomem);
+        ReallyNotTty = DefinitelyNotTty;
+        if (mc.needsterminal
+             && DefinitelyNotTty) {
+            int j;
+            sprintf(cmd, " %s -P -b -c '%s", METAMAIL, ThisContentType);
+            for (j=0; j<CParamsUsed; ++j) {
+                strcat(cmd, " ; ");
+                strcatquoting(cmd, CParams[j]);
+                strcat(cmd, " = ");
+                strcatquoting(cmd, CParamValues[j]);
+            }
+            strcat(cmd, "' ");
+            strcat(cmd, TmpFileName);
+            CreateNewWindowPrefix(FullCmd);
+            strcat(FullCmd, cmd);
+            DefinitelyNotTty = 0; /* For recursive call */
+        } else {
+            strcpy(FullCmd, cmd);
+        }
+        DidExecute = 0;
+        if (UsedTmpFileName || PartsWritten) {
+            int isempty;
+            if (PartsWritten) {
+                isempty = 0;
+            } else {
+                isempty = WriteTmpFile(TmpFileName, ThisContentType);
+            }
+            if (!isempty || strncmp(ThisContentType, "text", 4)) {
+                if (DoInBackground && !PartsWritten && !mc.needsterminal) {
+#ifdef AMIGA
+                    char TmpCmd[80], TmpScriptName[40];
+                    sprintf(TmpCmd, "run execRmScript %s",
+                            MkRmScript(FullCmd, TmpFileName, TmpScriptName));
+#else
+                    char TmpCmd[CMDSIZE];
+                    sprintf(TmpCmd, "(%s; rm %s) &", FullCmd, TmpFileName);
+#endif
+                    DefinitelyNotTty = 1; /* in background */
+                    SetUpEnvironment();
+                    resultcode = ExecuteCommand(TmpCmd, 1);
+                    ++DidExecute;
+                } else {
+                    SetUpEnvironment();
+                    resultcode = ExecuteCommand(FullCmd, 1);
+                    unlink(TmpFileName);
+                    ++DidExecute;
+                }
+            } else { /* empty text part, hack to not say "more" */
+                unlink(TmpFileName);
+            }
+        } else {
+            FILE *tmpfp;
+            SetUpEnvironment();
+            (void) ExecuteCommand(FullCmd, 0);
+            tmpfp = popen(FullCmd, WRITE_BINARY);
+            TranslateInputToOutput(InputFP, tmpfp, EncodingCode, ThisContentType);
+            resultcode = tmpfp ? pclose(tmpfp) : -1;
+            ++DidExecute;
+        }
+        DefinitelyNotTty = ReallyNotTty;
+        if (!DefinitelyNotTty && DidExecute) {
+            RestoreTtyState();
+            if (mc.copiousoutput && MaybePageOutput && BoundaryCt > 0) PauseForUser();
+        }
+        if (!resultcode) {
+            free(FullCmd);
+        } else {
+            fprintf(stderr, "Command failed: %s\n", FullCmd);
+            if (MaybePageOutput && BoundaryCt > 0) PauseForUser();
+            ++ProcessingErrors;
+        }
+    } else {
+        /* user does not want to execute command */
+        if (!DefinitelyNotTty) {
+            RestoreTtyState();
+        }
+        if (DoDebug) fprintf(stderr, "Not executing command.\n");
+        if (!PartsWritten) ConsumeRestOfPart(NULL);
+    }
+    if (PartsWritten) {
+        struct part *tp;
+        char HeadFile[MAX_FILE_NAME_SIZE];
+
+        while (PartsWritten) {
+            tp=PartsWritten->next;
+            free(PartsWritten->ctype);
+            strcpy(HeadFile, PartsWritten->fname);
+            strcat(HeadFile, "H");
+            unlink(HeadFile);
+            unlink(PartsWritten->fname);
+            free(PartsWritten->fname);
+            free(PartsWritten);
+            PartsWritten=tp;
+        }
+    }
+    if (!DefinitelyNotTty) {
+        RestoreTtyState();
+    }
+    free(cmd);
+    return(0);
+}
+
+PassesTest(mc)
+struct MailcapEntry *mc;
+{
+    int result;
+    char *cmd, TmpFileName[TMPFILE_NAME_SIZE];
+
+    if (!mc->testcommand) return(1);
+    MkTmpFileName(TmpFileName);
+    cmd = malloc(CMDSIZE);
+    if (!cmd) ExitWithError(nomem);
+    BuildCommand(cmd, mc->testcommand, TmpFileName, NULL, NULL);
+    if (DoDebug) printf("Executing test command: %s\n", cmd);
+    result = system(cmd);
+#ifdef MSDOS
+    result = 0;	    /* system doesn't return a valid exit code on MS-DOS */
+                    /* note that this makes the test feature useless... */
+#endif
+    free(cmd);
+    return(!result);
+}
+
+char *
+GetCommand(s, t)
+char *s, **t;
+{
+    char *s2;
+    int quoted = 0;
+    s2 = malloc(strlen(s)*2+1); /* absolute max, if all % signs */
+    if (!s2) ExitWithError(nomem);
+    *t = s2;
+    while (s && *s) {
+	if (quoted) {
+            if (*s == '%') *s2++ = '%'; /* Quote through next level, ugh! */
+
+            *s2++ = *s++;
+	    quoted = 0;
+	} else {
+	    if (*s == ';') {
+                *s2 = 0;
+		return(++s);
+	    }
+	    if (*s == '\\') {
+		quoted = 1;
+		++s;
+	    } else {
+		*s2++ = *s++;
+	    }
+	}
+    }
+    *s2 = 0;
+    return(NULL);
+}	
+
+GetMailcapEntry(fp, mc)
+FILE *fp;
+struct MailcapEntry *mc;
+{
+    int rawentryalloc = 2000, len;
+    char *rawentry, *s, *t, *LineBuf;
+
+    LineBuf = malloc(LINE_BUF_SIZE);
+    if (!LineBuf) ExitWithError(nomem);
+    rawentry = malloc(1 + rawentryalloc);
+    if (!rawentry) ExitWithError(nomem);
+    *rawentry = 0;
+    while (fgets(LineBuf, LINE_BUF_SIZE, fp)) {
+	if (LineBuf[0] == '#') continue;
+        len = strlen(LineBuf);
+        if (len == 0) continue;
+        if (LineBuf[len-1] == '\n') LineBuf[--len] = 0;
+	if ((len + strlen(rawentry)) > rawentryalloc) {
+	    rawentryalloc += 2000;
+	    rawentry = realloc(rawentry, rawentryalloc+1);
+	    if (!rawentry) ExitWithError(nomem);
+	}
+	if (LineBuf[len-1] == '\\') {
+            LineBuf[len-1] = 0;
+	    strcat(rawentry, LineBuf);
+	} else {
+	    strcat(rawentry, LineBuf);
+	    break;
+	}
+    }
+    free(LineBuf);
+    for (s=rawentry; *s && isspace((unsigned char) *s); ++s) ;
+    if (!*s) {
+	/* totally blank entry -- quietly ignore */
+	free(rawentry);
+	return(0);
+    }
+    s = index(rawentry, ';');
+    if (!s) {
+	fprintf(stderr, "metamail: Ignoring invalid mailcap entry: %s\n", rawentry);
+	free(rawentry);
+	return(0);
+    }
+    *s++ = 0;
+    mc->needsterminal = 0;
+    mc->copiousoutput = 0;
+    mc->needtofree = 1;
+    mc->testcommand = NULL;
+    mc->label = NULL;
+    mc->printcommand = NULL;
+    mc->contenttype = malloc(1+strlen(rawentry));
+    if (!mc->contenttype) ExitWithError(nomem);
+    strcpy(mc->contenttype, rawentry);
+    t = GetCommand(s, &mc->command);
+    if (!t) {
+        free(rawentry);
+        return(1);
+    }
+    while (s && *s && isspace((unsigned char) *s)) ++s;
+    s = t;
+    while (s) {
+	char *arg, *eq;
+
+        t = GetCommand(s, &arg);
+/*        if (t) *t++ = 0; */
+        eq = index(arg, '=');
+        if (eq) *eq++ = 0;
+	if (*arg) {
+	    arg = Cleanse(arg);
+	    if (!strcmp(arg, "needsterminal")) {
+		mc->needsterminal = 1;
+	    } else if (!strcmp(arg, "copiousoutput")) {
+		mc->copiousoutput = 1;
+	    } else if (eq && !strcmp(arg, "test")) {
+		mc->testcommand = eq;
+	    } else if (eq && !strcmp(arg, "description")) {
+		mc->label = eq;
+	    } else if (eq && !strcmp(arg, "label")) { 
+		mc->label = eq; /* bogus old name for description */
+	    } else if (eq && !strcmp(arg, "print")) {
+		mc->printcommand = eq;
+	    } else if (eq && !strcmp(arg, "textualnewlines")) {
+		ExceptionalNewline(mc->contenttype, atoi(eq));
+	    } else if (strcmp(arg, "notes")) { /* IGNORE notes field */
+		if (*arg && DoDebug) fprintf(stderr, "metamail: Ignoring mailcap flag: %s\n", arg);
+	    }
+	}
+	s = t;
+    }
+    free(rawentry);
+    return(1);
+}
+
+ExitWithError(txt)
+char *txt;
+{
+    if (txt) fprintf(stderr, "metamail: %s\n", txt);
+    exit(-1);
+}
+
+char *
+FreshHeaderCopy(s)
+char *s;
+{
+    char *t, *newcopy;
+    int len;
+
+    while (s && *s && isspace((unsigned char) *s) && *s != '\n') ++s;
+    t = index(s, '\n');
+    while (t && (*(t+1) == ' ' || *(t+1) == '\t')) {
+        t = index(t+1, '\n');
+    }
+    len = t ? (t-s+1) : (strlen(s)+1);
+    newcopy = malloc(len+3);/* two extra bytes for a bizarre bug caused by the fact that FindParam calls FreshHeaderCopy and sometimes tacks on "--". */
+    if (!newcopy) ExitWithError(nomem);
+    strncpy(newcopy, s, len);
+    newcopy[len] = 0;
+    return(newcopy);
+}
+
+Read822Prefix(PrintHeads, nestingdepth)
+int PrintHeads, nestingdepth;
+{
+    int SawNewline = 1, bytes = 0, alloced = 1000, HasEncodedChars=0;
+    int c, oldbytes;
+    char *s, *t, *tmp;
+
+    if (!PrintSomeHeaders) PrintHeads = 0;
+    mailheaders = malloc(alloced+1);
+    if (!mailheaders) ExitWithError(nomem);
+    strcpy(mailheaders, "MM_HEADERS=\n");
+    bytes = 12;
+yankagain:
+    t = mailheaders + bytes;
+    oldbytes = bytes-1; /* a hack for YankMode */
+    while ((c = getc(InputFP)) != EOF) {
+        if (++bytes >= alloced) {
+            alloced += 1000;
+            mailheaders = realloc(mailheaders, alloced);
+            if (!mailheaders) ExitWithError(nomem);
+            t = mailheaders + bytes - 1;
+        }
+        if (c == '\n') {
+            if (SawNewline) break;
+            SawNewline = 1;
+        } else SawNewline = 0;
+        *t++ = c;
+    }
+    *t = 0;
+    --bytes;
+    if (c == EOF) {
+	if (nestingdepth) {
+	    fprintf(stderr, "metamail: Incomplete multipart message -- unexpected EOF\n");
+/*            exit(ProcessingErrors); */
+        } else {
+            if (YankMode) {
+/*                ExitWithError("Could not extract a MIME message from the  body\n"); */
+		fprintf(stderr, "metamail: Could not extract a MIME message from the body\n");
+            } else {
+		fprintf(stderr, "metamail: Could not find end of mail headers.\n");
+/*                ExitWithError("Could not find end of mail headers"); */
+            }
+	}
+	BoundaryCt=0;
+	return -1;
+    }
+    for (s=mailheaders+oldbytes; *s; ++s) {
+        if (*s == '\n' && (*(s+1) != ' ') && (*(s+1) != '\t')) {
+	    if (!ContentType && !lc2strncmp(s, "\ncontent-type:", 14)) {
+		char *dum;
+                ContentType = FreshHeaderCopy(s+14);
+		/* Eliminate white space embedded in content-type */
+		while (1) {
+		    dum = index(ContentType, '/');
+		    if (!dum) break;
+		    if (isspace(*(dum-1))) {
+			for (--dum; *dum; ++dum) {
+			    *dum = *(dum+1);
+			}
+		    } else if (isspace(*++dum)) {
+			for ( ; *dum; ++dum) {
+			    *dum = *(dum+1);
+			}
+		    } else {
+			break;
+		    }
+		}
+                StripTrailingSpace(ContentType);
+                ParseContentParameters(ContentType);
+                if (PrintHeads) maybephead(s+1);
+            } else if (!ContentEncoding && !lc2strncmp(s, "\ncontent-transfer-encoding:", 27)) {
+                ContentEncoding = FreshHeaderCopy(s+27);
+                if (PrintHeads) maybephead(s+1);
+            } else if (!lc2strncmp(s, "\nsubject:", 9)) {
+                if (PrintHeads) maybephead(s+1);
+                MailSubject = FreshHeaderCopy(s+9);
+            } else if (!lc2strncmp(s, "\nfrom:", 6)) {
+                if (PrintHeads) maybephead(s+1);
+                MailFrom = FreshHeaderCopy(s+6);
+            } else if (!lc2strncmp(s, "\ncontent-description:", 4)) {
+                if(PrintHeads) maybephead(s+1);
+                MailSubject = FreshHeaderCopy(s+21);
+            } else {
+                /* Print any with encoded variables */
+                char *dum = s;
+                while (dum) {
+                    dum = index(dum, '?');
+                    if (dum && *++dum == '=') break;
+                }
+                if (dum) {
+                    char *nl = s+1;
+                    while (nl) {
+                        nl = index(nl, '\n');
+                        if (nl && !isspace((unsigned char) *++nl)) break;
+                    }
+                    if (nl && nl > dum) ++HasEncodedChars;
+                }
+                if (HasEncodedChars) {
+                    phead(s+1);
+                } else if (PrintHeads) {
+                    maybephead(s+1);
+                }
+            }
+        }
+    }
+    /* Ugly, but effective */
+    if (YankMode && !ContentType) {
+        goto yankagain;
+    }
+    if (PrintHeads) printf("\n");
+    if (!ContentType) {
+        ContentType = "text/plain";
+        CParamsUsed=0;
+    }
+    for (tmp=ContentType; *tmp; ++tmp) {
+        if (isupper((unsigned char) *tmp)) *tmp = tolower((unsigned char) *tmp);
+    }
+    return 0;
+}
+
+PrepareMessage() {
+    int c;
+
+    EncodingCode = ENCODING_NONE;
+    if (ContentEncoding) {
+        /* strip leading white space */
+        while (*ContentEncoding && isspace((unsigned char) *ContentEncoding)) ++ContentEncoding;
+        StripTrailingSpace(ContentEncoding);
+        if (!lc2strcmp(ContentEncoding, "base64")) {
+            EncodingCode = ENCODING_BASE64;
+        } else if (!lc2strcmp(ContentEncoding, "quoted-printable")) {
+            EncodingCode = ENCODING_QUOTEDPRINTABLE;
+        } else if (!lc2strncmp (ContentEncoding, "x-uue", 5)) {
+            fprintf (stderr, "WARNING:  Using nonstandard %s encoding, trying uuencode algorithm.\n", ContentEncoding);
+ 	    EncodingCode = ENCODING_UUENCODE;
+        } else {
+            if (lc2strcmp(ContentEncoding, "none")
+                 && !lc2strcmp(ContentEncoding, "8bit")
+                 && !lc2strcmp(ContentEncoding, "7bit")) {
+                fprintf(stderr, "Ignoring unrecognized Content-Transfer-Encoding value: %s\n", ContentEncoding);
+            }
+        }
+    }
+    if (EatLeadingNewlines) {
+        while ((c = getc(InputFP)) != EOF) {
+            if (c != '\n') {
+                ungetc(c, InputFP);
+                break;
+            }
+        }
+    }
+    SetUpEnvironment();  
+}
+
+SetUpEnvironment() { 
+    int i, j, environsize;
+    char **newenviron, *mailervar, *summaryvar, *ctypevar, *s;
+    static char ttyenv[15], debugenv[15], *noaskenv, pagerenv[15], *quietenv, rootenv[25];
+
+#if !defined(AMIGA) && !defined(MSDOS)
+    /* Hack to make the code look similar for unix & dos */
+#define putenv(var)        newenviron[i++] = var;
+    for (environsize=0; environ[environsize]; ++environsize) {
+	;
+    }
+    newenviron = (char **) malloc(sizeof(char *) * (17+environsize));
+    if (!newenviron) ExitWithError(nomem);
+#endif
+    mailervar = malloc(13+strlen(MailerName));
+    if (!mailervar) ExitWithError(nomem);
+    sprintf(mailervar, "MM_MAILER=%s", MailerName);
+    summaryvar = malloc(26 + strlen(MailFrom) + strlen(MailSubject));
+    if (!summaryvar) ExitWithError(nomem);
+    sprintf(summaryvar, "MM_SUMMARY=%s (from %s)", MailSubject, MailFrom);
+    MailSummary = summaryvar+11;
+    EliminateNastyChars(MailSummary);
+    i = 0;
+    if (ContentType) {
+        int ctypelen = 22+strlen(ContentType);
+        for (j=0; j<CParamsUsed; ++j) {
+            ctypelen += 6 + strlen(CParams[j]) + strlen(CParamValues[j]);
+        }
+        ctypevar = malloc(ctypelen);
+        if (!ctypevar) ExitWithError(nomem);
+        for (s=ContentType; *s; ++s) {
+            if (isupper((unsigned char) *s)) *s = tolower((unsigned char) *s);
+        }
+        while (isspace((unsigned char) *--s)) *s = 0;
+        sprintf(ctypevar, "MM_CONTENTTYPE=%s", ContentType);
+        for (j=0; j<CParamsUsed; ++j) {
+            strcat(ctypevar, " ; ");
+            strcat(ctypevar, CParams[j]);
+            strcat(ctypevar, " = ");
+            strcat(ctypevar, CParamValues[j]);
+        }
+        putenv(ctypevar);
+    }
+    putenv(mailheaders ? mailheaders : "MM_HEADERS=unknown");
+    putenv(mailervar);
+    putenv(summaryvar);
+    sprintf(ttyenv, "MM_NOTTTY=%d", DefinitelyNotTty);
+    putenv(ttyenv);
+    sprintf(debugenv, "MM_DEBUG=%d", DoDebug);
+    putenv(debugenv);
+    s = getenv("MM_QUIET");
+    if (!s) s = QuietDefault;
+    quietenv = malloc(15 + strlen(s));
+    if (!quietenv) ExitWithError(nomem);
+    if (Quiet) {
+        strcpy(quietenv, "MM_QUIET=1");
+    } else {
+        sprintf(quietenv, "MM_QUIET=%s", s);
+    }
+    putenv(quietenv);
+    s = getenv("MM_NOASK");
+    if (!s) s = NoAskDefault;
+    noaskenv = malloc(15 + strlen(s));
+    if (!noaskenv) ExitWithError(nomem);
+    if (MightAskBeforeExecuting) {
+        sprintf(noaskenv, "MM_NOASK=%s", s);
+    } else {
+        strcpy(noaskenv, "MM_NOASK=1");
+    }
+    putenv(noaskenv);
+    s = getenv("MM_RUNASROOT");
+    if (!s) s = "0";
+    sprintf(rootenv, "MM_RUNASROOT=%s", s);
+    putenv(rootenv);
+    sprintf(pagerenv, "MM_USEPAGER=%d", MaybePageOutput);
+    putenv(pagerenv);
+#if !defined(AMIGA) && !defined(MSDOS)
+    for (j=0; j<environsize; ++j) {
+        if (strncmp(environ[j], "MM_", 3) || !strncmp(environ[j], "MM_CHARSET", 10)) {
+            putenv(environ[j]);
+        }
+    }
+    newenviron[i] = NULL;
+    environ = newenviron;
+    if (DoDebug) {
+        printf("Here is the environment:\n\n");
+        system("printenv");
+    }
+#endif
+}
+
+
+#ifdef AMIGA
+int
+putenv(def)
+char *def;
+{
+    char *cp;
+    char nameBuf[100];
+    FILE *envFile;
+
+    if ((cp = index(def, '=')) == NULL || def == cp) {
+        return(1);
+    }
+
+    strcpy(nameBuf, "ENV:");
+    strncat(nameBuf, def, cp - def);
+    nameBuf[(cp - def) + 4] = 0;
+    cp++;               /* Now points to value part of environment string. */
+
+    if ((envFile = fopen(nameBuf, "w")) == NULL) {
+        return(2);
+    }
+
+    fputs(cp, envFile);
+    fclose(envFile);
+
+    return(0);
+}
+#endif
+
+OKToRun(ctype, progname, label)
+char *ctype, *progname, *label;
+{
+    char AnsBuf[100], *s;
+
+    if (DoInBackground) return(1);
+    if (DefinitelyNotTty || MustNotBeTty) return(1);
+    while (1) {
+        printf("\n");
+        if (label) {
+            printf("This message contains %s.\nDo you want to view it using the '%s' command (y/n) [y] ? ", label, ShortCommand(progname));
+        } else {
+            printf("This message contains '%s'-format data.\nDo you want to view it using the '%s' command (y/n) [y] ? ", ctype, ShortCommand(progname));
+        }
+        s = fgets(AnsBuf, sizeof(AnsBuf), stdin);
+        if (!s) return(0); /* EOF */
+	while (s && *s && isspace((unsigned char) *s)) ++s;
+	if (*s == 'y' || *s == 'Y' || !*s || *s == '\n') return(1);
+	if (*s == 'n' || *s == 'N' || *s == 'q' || *s == 'Q') {
+	    return(0);
+	}
+	printf("Please answer yes or no.\n");
+    }
+}
+
+EliminateNastyChars(s)
+char *s;
+{
+    if (s) for( ; *s ;++s) {
+        if (isalnum((unsigned char) *s)) continue;
+	if (index(" ,.;:/?\\|[]{}()*&^%#@-_=+~<>\"", *s)) continue;
+	if (*s == '\'' || *s == '`') {
+	    *s = '"';
+	} else {
+	    *s = ' ';
+	}
+    }
+}
+
+StripTrailingSpace(s)
+char *s;
+{
+    char *t = s+strlen(s) -1;
+    while (isspace((unsigned char) *t) && (t >= s)) *t-- = 0;
+}
+
+static char *KeyHeads=NULL;
+static char **KeyHeadList;
+static int KeyKeep = 0;
+
+void setKeyHeads()
+{
+    char *s;
+    int numkeys = 0;
+
+    if ((KeyHeads = getenv("KEYHEADS")) != 0) {
+        for (s=KeyHeads;*s;++s) if (isupper((unsigned char) *s)) *s=tolower((unsigned char) *s);
+    } else if ((KeyHeads = getenv("KEYIGNHEADS")) != 0) {
+	for (s=KeyHeads;*s;++s) if (isupper((unsigned char) *s)) *s=tolower((unsigned char) *s);
+	KeyKeep = 1;
+    } else {
+	static char khtmp[] = "to:cc:subject:from:content-description:date";
+	KeyHeads = khtmp;
+    }
+    for (s=KeyHeads; *s; ++s) if (*s == ':') ++numkeys;
+    numkeys += 2;
+    KeyHeadList = (char **) malloc((numkeys) * sizeof(char *));
+    if (!KeyHeadList) ExitWithError(nomem);
+    numkeys = 0;
+    KeyHeadList[0] = KeyHeads;
+    for(s=KeyHeads; *s; ++s) {
+	if (*s == ':') {
+	    *s = '\0';
+	    KeyHeadList[++numkeys] = s+1;
+	}
+    }
+    KeyHeadList[++numkeys] = NULL;
+}
+
+/* find the first colon in a header line which appears before any spaces or control characters */
+char *
+findcolon(hdr)
+char *hdr;
+{
+    while (*hdr && !isspace(*hdr) && !iscntrl(*hdr))
+	if (*hdr == ':') return hdr;
+	else hdr++;
+    return 0;
+}
+
+/* check the header given to see if it matches any in the KeyHeadList */
+maybephead(hdr)
+char *hdr;
+{
+    char *s;
+    int numkeys=0;
+
+    if (!KeyHeads) setKeyHeads();
+
+    s = findcolon(hdr);
+    if (s) {
+	int len = s - hdr;
+        for (numkeys=0; KeyHeadList[numkeys]; ++numkeys) {
+            if (!strcmp(KeyHeadList[numkeys], "*")
+                 || !lc2strncmp(hdr, KeyHeadList[numkeys], len)) {
+		if (!KeyKeep) phead(hdr);
+		return;
+            }
+        }
+	if (KeyKeep) phead(hdr);
+	return;
+    }
+    if (!strncmp(hdr, "From ", 5) || !strncmp(hdr, ">From ", 6)) {
+	for (numkeys = 0; KeyHeadList[numkeys]; ++numkeys) {
+	    if (!strcmp(KeyHeadList[numkeys], "*")
+		 || !lc2strncmp(">from", KeyHeadList[numkeys], 5)) {
+		if (!KeyKeep) phead(hdr);
+		return;
+	    }
+	}
+	if (KeyKeep) phead(hdr);
+    }
+}
+
+/* This next routine prints out a mail header, and needs to deal with the new extended charset headers. */
+phead(s)
+char *s;
+{
+    char *t = s;
+
+    while (1) {
+	t = index(t, '\n');
+	if (!t) break;
+        if (!isspace((unsigned char) *(t+1))) {
+            *t = 0;
+	    break;
+	} else ++t;
+    }
+    PrintHeader(s, 1);
+    printf("\n");
+    if (t) *t = '\n';
+}
+
+static char PrevCharset[100] = "us-ascii";
+
+/* This is the part that actually handles the charset issues */
+void PrintHeader(s, ShowLeadingWhitespace)
+char *s;
+int ShowLeadingWhitespace;
+{
+    char *charset, *encoding, *txt, *txtend, TmpFile[TMPFILE_NAME_SIZE];
+    int ecode = ENCODING_NONE, CorrectedCharset = 0;
+    FILE *fp;
+
+    while (*s && (*s != '=')) {
+        if (isspace((unsigned char) *s)) {
+            if (ShowLeadingWhitespace) {
+                putchar(' ');
+            }
+        } else {
+            putchar(*s);
+            if (!CorrectedCharset) {
+                CorrectedCharset = 1;
+                strcpy(PrevCharset, "us-ascii");
+            }
+        }
+        if (!ShowLeadingWhitespace) {
+            /* Only at most one leading space is ignored */
+            ShowLeadingWhitespace = 1;
+        }
+        ++s;
+    }
+    if (!*s) return;
+    if (*(s+1) != '?') {
+        putchar('=');
+        PrintHeader(++s, 1);
+        return;
+    }
+    charset = s+2;
+    encoding = index(charset, '?');
+    if (!encoding) {
+        putchar('=');
+        PrintHeader(++s,1);
+        return;
+    }
+    txt = index(encoding+1, '?');
+    if (!txt) {
+        putchar('=');
+        PrintHeader(++s, 1);
+        return;
+    }
+    txtend = txt;
+    do {
+        txtend = index(txtend+1, '?');
+    } while(txtend && (*(txtend+1) != '='));
+    if (!txtend) {
+        putchar('=');
+        PrintHeader(++s, 1);
+    }
+    /* Proper parse! Ready to dissect... */
+    *encoding = 0;
+    *txt = 0;
+    *txtend = 0;
+    if ((*(encoding+1) == 'q') || (*(encoding+1) == 'Q')) {
+        ecode = ENCODING_QUOTEDPRINTABLE;
+    } else if ((*(encoding+1) == 'b') || (*(encoding+1) == 'B')) {
+        ecode = ENCODING_BASE64;
+    } else {
+        fprintf(stderr, "Bad encoding value in non-ASCII header string: %s\n", encoding+1);
+    }
+    if (lc2strcmp(charset, PrevCharset)) {
+        char *s2, *charsetinuse;
+
+        strcpy(PrevCharset, charset);
+        for (s2=PrevCharset; *s2; ++s2) {
+            if (isupper((unsigned char) *s2)) *s2 = tolower((unsigned char) *s2);
+        }
+        charsetinuse = getenv("MM_CHARSET");
+        if (!charsetinuse || lc2strcmp(charsetinuse, PrevCharset)) {
+            printf("[** %s charset **] ", charset);
+        }
+    }
+    if (ecode == ENCODING_NONE) {
+        printf(txt+1);
+    } else {
+        /* What follows is REALLY bogus, but all my encoding stuff is pipe-oriented right now... */
+        MkTmpFileName(TmpFile);
+        fp = fopen(TmpFile, WRITE_BINARY);
+        if (!fp) {
+            fprintf(stderr, "Could not open temporary file\n");
+        } else {
+            char *t;
+            for (t=txt+1; *t; ++t) {
+                if (*t == '_') {
+                    putc(' ', fp);
+                } else if (*t == '\n') {
+                    putc(' ', fp);
+                } else {
+                    putc(*t, fp);
+                }
+            }
+            fclose(fp);
+            fp = fopen(TmpFile, "r");
+            if (!fp) {
+                fprintf(stderr, "Could not open temporary file\n");
+            } else {
+                TranslateInputToOutput(fp, stdout, ecode, "text");
+                fclose(fp);
+            }
+            unlink(TmpFile);
+        }
+    }
+    *encoding = '?';
+    *txt = '?';
+    *txtend = '?';
+    PrintHeader(txtend + 2, 0);
+}
+
+BuildCommand(Buf, controlstring, TmpFileName, UsedTmpFileName, PartsWritten)
+char *Buf, *controlstring, *TmpFileName;
+int *UsedTmpFileName;
+struct part **PartsWritten;
+{
+    char *from, *to, *s, *p, *tmp;
+    int prefixed = 0, UsedBigFile=0, UsedLittleFiles=0, numparts=0;
+    struct part *firstpart=NULL, *thispart=NULL, *tmppart=NULL;
+
+    if (UsedTmpFileName) *UsedTmpFileName = 0;
+    if (PartsWritten) *PartsWritten = NULL;
+    for (from=controlstring, to=Buf; *from; ++from) {
+        if (prefixed) {
+            prefixed = 0;
+            switch(*from) {
+                case '%':
+                    *to++ = '%';
+                    break;
+                case 'n':
+                case 'F':
+		    if (!PartsWritten) {
+			fprintf(stderr, "metamail: Bad mailcap \"test\" clause: %s\n", controlstring);
+			ExitWithError("%%n and %%F may not be used in \"test\" clauses.  Execution terminated.");
+		    }
+                    if (UsedBigFile) {
+                        fprintf(stderr, "metamail: Bad mailcap entry: %s\n", controlstring);
+                        ExitWithError("%%n and %%F are incompatible with %%s.  Execution terminated.");
+                    }
+                    if (!UsedLittleFiles) {
+                        /* Set up parts */
+                        char *LineBuf, *boundary, TmpFileNameBuf[TMPFILE_NAME_SIZE];
+                        char *oldct, *oldce, *newct;
+                        int currct, boundarylen, newctlen, j;
+                        int oldcparmsused, oldcparamsalloced;
+                        char **oldcparams, **oldcparamvalues;
+                        FILE *headfp;
+
+                        LineBuf = malloc(LINE_BUF_SIZE);
+                        if (!LineBuf) ExitWithError(nomem);
+                        boundary = FindParam("boundary");
+			if (!boundary) {
+			    fprintf(stderr, "Bad message format: This multipart message has no boundary parameter,\n");
+			    fprintf(stderr, "but the mailcap entry for %s uses %%F or %%n.\n\n", ContentType);
+			    ExitWithError("A change to the mailcap file might make this message viewable.");
+                        }
+                        if (boundary[0] == '"') {
+                            boundary=UnquoteString(boundary);
+                        }
+                        sprintf(LineBuf, "--%s", boundary);
+                        strcpy(boundary, LineBuf);
+                        boundarylen = strlen(boundary);
+                        if (BoundaryCt >= BoundaryAlloc) {
+                            BoundaryAlloc += 5;
+                            if (Boundaries) {
+                                Boundaries = (char **) realloc(Boundaries, BoundaryAlloc*sizeof(char *));
+                            } else {
+                                Boundaries = (char **) malloc(BoundaryAlloc*sizeof(char *));
+                            }
+                            if (!Boundaries) ExitWithError(nomem);
+                        }
+                        Boundaries[BoundaryCt++] = boundary;
+                        while (fgets(LineBuf, LINE_BUF_SIZE, InputFP)) { /* find start */
+                            if (!strncmp(LineBuf, boundary, boundarylen)
+                                 && ((LineBuf[boundarylen] == '\n')
+                                      || (LineBuf[boundarylen] == '-'
+                                           && LineBuf[boundarylen+1] == '-'
+                                           && LineBuf[boundarylen+2] == '\n'))) {
+                                break;
+                            }
+                        }
+                        free(LineBuf);
+                        currct = BoundaryCt;
+                        oldct=ContentType;
+                        oldce=ContentEncoding;
+                        oldcparmsused = CParamsUsed;
+                        oldcparamsalloced = CParamsAlloced;
+                        oldcparams = CParams;
+                        oldcparamvalues = CParamValues;
+                        CParams = NULL;
+                        CParamValues = NULL;
+                        CParamsUsed = 0;
+                        CParamsAlloced = 0;
+                        while(currct == BoundaryCt) {
+                            tmppart = (struct part *) malloc(sizeof(struct part));
+                            if (!tmppart) ExitWithError(nomem);
+                            if (firstpart) {
+                                thispart->next = tmppart;
+                                thispart = tmppart;
+                            } else {
+                                firstpart = thispart = tmppart;
+                            }
+                            tmppart->next = NULL;
+                            ContentType=NULL;
+                            ContentEncoding=NULL;
+                            Read822Prefix(0,0);
+                            PrepareMessage();
+                            newctlen=5+strlen(ContentType);
+                            for (j=0; j<CParamsUsed; ++j) {
+                                newctlen += 11+strlen(CParams[j]) + strlen(CParamValues[j]);
+                            }
+                            newct= malloc(newctlen);
+                            if (!newct) ExitWithError(nomem);
+                            strcpy(newct, "'");
+                            strcat(newct, ContentType);
+                            for (j=0; j<CParamsUsed; ++j) {
+                                strcat(newct, "; ");
+                                strcat(newct, CParams[j]);
+                                if (CParamValues[j][0] == '\"') {
+                                    strcat(newct, " = ");
+                                    strcat(newct, CParamValues[j]);
+                                } else {
+                                    strcat(newct, " = \"");
+                                    strcat(newct, CParamValues[j]);
+                                    strcat(newct, "\"");
+                                }
+                            }
+                            strcat(newct, "'");
+                            thispart->ctype = newct;
+                            MkTmpFileName(TmpFileNameBuf);
+                            thispart->fname = malloc(1+strlen(TmpFileNameBuf));
+                            if (!thispart->fname) ExitWithError(nomem);
+                            strcpy(thispart->fname, TmpFileNameBuf);
+                            WriteTmpFile(thispart->fname, thispart->ctype);
+                            strcat(TmpFileNameBuf, "H");
+                            headfp = fopen(TmpFileNameBuf, "w");
+                            if (headfp) {
+                                fputs(mailheaders+12, headfp);
+                                /* The +12 gets rid of MM_HEADERS=\n */
+                                fclose(headfp);
+                            }
+                            ++numparts;
+                        }
+                        ContentType=oldct;
+                        ContentEncoding=oldce;
+                        CParamsUsed = oldcparmsused;
+                        CParamsAlloced = oldcparamsalloced;
+                        CParams = oldcparams;
+                        CParamValues = oldcparamvalues;
+                        /* Now we've seen the last encapsulation boundary, but if there is a "postfix"
+                            we must throw it away.*/
+                        if (BoundaryCt > 0) {
+                            ConsumeRestOfPart(NULL);
+                        }
+                        *PartsWritten = firstpart;
+                        UsedLittleFiles=1;
+                    }
+                    if (*from == 'n') {
+                        char numbuf[10];
+                        sprintf(numbuf, "%d", numparts);
+                        strcpy(to, numbuf);
+                        to += strlen(numbuf);
+                    } else { /* %F */
+                        for (tmppart = firstpart; tmppart != NULL; tmppart = tmppart->next) {
+                            sprintf(to, "%s %s ", tmppart->ctype, tmppart->fname);
+                            to += (strlen(tmppart->ctype) + strlen(tmppart->fname) + 2);
+                        }
+                    }
+                    break;
+                case 's':
+                    if (UsedLittleFiles) {
+                        fprintf(stderr, "metamail: Bad mailcap entry: %s\n", controlstring);
+                        ExitWithError("%%n and %%F are incompatible with %%s.  Execution terminated.");
+                    }
+                    if (TmpFileName) {
+                        strcpy(to, TmpFileName);
+                        to += strlen(TmpFileName);
+                        if (UsedTmpFileName) ++(*UsedTmpFileName);
+                    }
+                    UsedBigFile = 1;
+                    break;
+                case '{':
+                    s = index(from, '}');
+                    if (!s) {
+                        fprintf(stderr, "Ignoring ill-formed parameter reference in mailcap file: %s\n", from);
+                        break;
+                    }
+                    ++from;
+                    *s = 0;
+                    /* put in lower case */
+                    for (tmp=from; *tmp; ++tmp) {
+                        if (isupper((unsigned char) *tmp)) *tmp = tolower((unsigned char) *tmp);
+                    }
+                    p = FindParam(from);
+                    if (p && p[0] == '"') {
+                        p=UnquoteString(p);
+                    }
+                    if (!p) p = "";
+                    *to++ = '\'';
+                    strcpynoquotes(to, p);
+                    to += strlen(p);
+                    *to++ = '\'';
+                    *s = '}'; /* restore */
+                    from = s;
+                    break;
+                case 't':
+                    /* type/subtype */
+                    strcpynoquotes(to, ContentType);
+                    to += strlen(ContentType);
+                    break;
+                default:
+                    fprintf(stderr, "Ignoring unrecognized format code in mailcap file: %%%c\n", *from);
+                    break;
+            }
+        } else if (*from == '%') {
+            prefixed = 1;
+        } else {
+            *to++ = *from;
+        }
+    }
+    *to = 0;
+}
+
+strcpynoquotes(t,f)
+char *t, *f;
+{
+    static char *badchars="|<>%*?\"`'";
+
+    while (*f) {
+        if (index(badchars, *f)) *t++ = ' '; else *t++ = *f;
+        ++f;
+    }
+}
+
+WriteTmpFile(fname, ctype)
+char *fname;
+char *ctype;
+{
+    FILE *fpout;
+    int retval = 0;
+
+    fpout = fopen(fname, WRITE_BINARY);
+    if (!fpout) {
+        perror("WriteTmpFile");
+        ExitWithError("Can't create temporary file");
+    }
+    TranslateInputToOutput(InputFP, fpout, EncodingCode, ctype);
+    if (ftell(fpout) == 0) retval = 1;
+    if (fclose(fpout)) ExitWithError("Can't write temporary file");
+    return(retval);
+}
+
+
+TranslateInputToOutput(InputFP, OutputFP, Ecode, ctype)
+FILE *InputFP, *OutputFP;
+int Ecode;
+char *ctype;
+{
+    int InMultipart = BoundaryCt > 0 ? 1 : 0;
+
+    switch(Ecode) {
+        case ENCODING_BASE64:
+            from64(InputFP, OutputFP, InMultipart ? Boundaries : NULL, &BoundaryCt, DoesNeedPortableNewlines(ctype));
+            break;
+        case ENCODING_QUOTEDPRINTABLE:
+            fromqp(InputFP, OutputFP, InMultipart ? Boundaries : NULL, &BoundaryCt);
+            break;
+ 	case ENCODING_UUENCODE:
+ 	    fromuue(InputFP, OutputFP, InMultipart ? Boundaries: NULL, &BoundaryCt);
+ 	    break;
+        default:
+            ConsumeRestOfPart(OutputFP);
+    }
+#if !defined(AMIGA) && !defined(MSDOS)
+    if (UsingStandardInput && feof(InputFP) && !freopen("/dev/tty", "r", stdin)) {
+        fprintf(stderr, "Warning: Cannot freopen /dev/tty to stdin");
+    } else InputFP = stdin;
+#endif
+}
+
+CreateNewWindowPrefix(Prefix)
+char *Prefix;
+{
+    char *override = getenv("TERMINAL_CMD");
+    if (override) {
+        strcpy(Prefix, override);
+#ifdef AMIGA
+    } else {
+        /* The window should *not* run in background. We are thus unable
+         * to use NewWsh or NewCLI.
+         */
+        /* strcpy(Prefix, "newwsh CMD "); */
+        Prefix[0] = 0;
+#else
+    } else if (getenv("DISPLAY")) {
+        /* X11 */
+        strcpy(Prefix, "xterm -title '");
+        strcat(Prefix, MailSummary);
+        strcat(Prefix, "' -e ");
+    } else if (getenv("WINDOW_PARENT")) {
+        /* SunView */
+        strcpy(Prefix, "shelltool ");
+    } else if (getenv("WMHOST")) {
+        /* old Andrew WM */
+        strcpy(Prefix, "h19 ");
+    } else {
+        /* last resort is to look for /dev/tty */
+        if (!freopen("/dev/tty", "r", stdin)){
+            ExitWithError("Don't know how to create a terminal window");
+        }
+        InputFP = stdin;
+        fprintf(stderr, "Warning, reopened /dev/tty, could be strange.\n");
+        Prefix[0] = 0;
+#endif
+    }
+}
+
+int HasSavedTtyState=0;
+#if !defined(AMIGA) && !defined(MSDOS)
+#ifdef SYSV
+static struct termio MyTtyStateIn, MyTtyStateOut;
+#else
+static struct sgttyb MyTtyStateIn, MyTtyStateOut;
+#endif
+#endif
+
+SaveTtyState() {
+    /* Bogus -- would like a good portable way to reset the terminal state here */
+#if !defined(AMIGA) && !defined(MSDOS)
+#ifdef SYSV
+    ioctl(fileno(stdin), TCGETA, &MyTtyStateIn);
+    ioctl(fileno(stdout), TCGETA, &MyTtyStateOut);
+#else
+    gtty(fileno(stdin), &MyTtyStateIn);
+    gtty(fileno(stdout), &MyTtyStateOut);
+#endif
+    HasSavedTtyState = 1;
+#endif
+}
+
+RestoreTtyState() {
+#if !defined(AMIGA) && !defined(MSDOS)
+#ifdef SYSV
+    if (HasSavedTtyState) {
+        ioctl(fileno(stdout), TCSETA, &MyTtyStateOut);
+        ioctl(fileno(stdin), TCSETA, &MyTtyStateIn);
+    }
+#else
+    if (HasSavedTtyState) {
+        stty(fileno(stdout), &MyTtyStateOut);
+        stty(fileno(stdin), &MyTtyStateIn);
+    }
+#endif
+#endif
+}
+
+NeedToAskBeforeExecuting(type)
+char *type;
+{
+    struct NoAskItem *nai;
+    if (!MightAskBeforeExecuting || DoInBackground) return(0);
+    for (nai = FirstNoAskItem; nai; nai = nai->next) {
+        if (CtypeMatch(type, nai->type)) return(0);
+    }
+    return(1);
+}
+
+NeedToBeQuiet(cmd)
+char *cmd;
+{
+    struct NoAskItem *nai;
+    for (nai = FirstQuietItem; nai; nai = nai->next) {
+        if (!lc2strcmp(nai->type, cmd)) return(1);
+    }
+    return(0);
+}
+
+CtypeMatch(ctype, pat)
+char *ctype, *pat;
+{
+    int len;
+    char pat2[200];
+
+    if (!lc2strcmp(ctype, pat)) {
+        return(1); /* exact match, case-insensitive */
+    }
+    if (index(pat, '/') == NULL) {
+        /* implicit wildcard */
+        strcpy(pat2, pat);
+        strcat(pat2, "/*");
+        pat = pat2;
+    }
+    len = strlen(pat);
+    if ((pat[--len] == '*')
+         && (pat[--len] == '/')
+         && (!lc2strncmp(ctype, pat, len))
+         && ((ctype[len] == '/') || (ctype[len] == '\0'))){
+        /* wildcard match */
+        return(1);
+    }
+    return(0);
+}
+
+ExecuteCommand(cmd, really)
+char *cmd;
+int really;
+{
+    int code;
+    if (!Quiet || DoDebug) {
+        if (!NeedToBeQuiet(ShortCommand(cmd))) {
+            printf("---Executing: %s\n", DoDebug ? cmd : ShortCommand(cmd));
+        } else if (EatLeadingNewlines) {
+            printf("\n");
+        } 
+        fflush(stdout);
+    }
+    if (really) {
+        fflush(stdout); fflush(stderr);
+        code = system(cmd);
+        if (DoDebug) printf("Command exit status: %d\n", code);
+#ifdef MSDOS
+	code = 0;	/* system doesn't return a valid exit code on MS-DOS */
+#endif
+        return(code);
+    }
+    return(0);
+}
+
+MkTmpFileName(name)
+char *name;
+{
+  int   length  = MAX_FILE_NAME_SIZE;
+  char* tmpname = NULL;
+
+#ifdef AMIGA
+    strcpy(name, "T:mmXXXXXX");
+    close(mkstemp(name));
+#else
+  #ifndef MSDOS
+    sprintf(name, "%s/mm.XXXXXX", tmproot);
+    close(mkstemp(name));
+  #else
+     strcpy(name, "TXXXXXX");
+     if (!close(mkstemp(name)))
+         name[0] = 0;
+     else
+         if (DoDebug) printf("temp name = \"%s\"\n", name);
+  #endif
+#endif
+     fprintf( stderr, "strlen\n");
+     if (name) 
+       length = strlen(name);
+
+     fprintf( stderr, "after strlen\n");
+     tmpname = malloc( sizeof(char) * length );
+     fprintf( stderr, "after malloc\n");
+     strcpy( tmpname, name );
+     fprintf( stderr, "after strcpy\n");
+     dlist_insertnew( &TmpNameListTail, (void*) tmpname );
+     fprintf( stderr, "after dlistinsert\n");
+     tmpname = NULL;
+}
+
+void
+CleanupTmpFiles( void )
+{
+  DList* help = TmpNameListTail;
+  DList* old = NULL;
+  
+  while (help) {
+    if (unlink( (char*) help->data ) < 0) 
+      if (DoDebug) 
+	fprintf( stderr, "error unlinking %s\n", (char*) help->data );
+    old = help;
+    help = help->prev;
+    free( old );
+  }
+  
+  TmpNameListTail = NULL;
+}
+
+#ifdef AMIGA
+/* We need to execute a command and then remove a file "fileToRemove".
+ * MkRmScript() creates a shell script that accomplishes this. The script
+ * is written to a temporary file. The name of the script is returned.
+ */
+char *
+MkRmScript(command, fileToRemove, nameBuf)
+char *command;
+char *fileToRemove;
+char *nameBuf;
+{
+    FILE *script;
+
+    MkTmpFileName(nameBuf);
+    if ((script = fopen(nameBuf, "w")) == NULL) {
+        fprintf(stderr, "Unable to open %s for writing\n", nameBuf);
+        exit(1);
+    }
+    fprintf(script, ".BRA {\n.KET }\n%s\nDelete %s QUIET\n", command, fileToRemove);
+    fclose(script);
+    return(nameBuf);
+}
+#endif
+
+void
+ConsumeRestOfPart(outfp)
+FILE *outfp;
+{
+    char *Buf;
+    int c;
+
+    if (BoundaryCt <= 0) {
+        while ((c=getc(InputFP)) != EOF) {
+            if (outfp) putc(c, outfp);
+        }
+        return;
+    }
+    Buf = malloc(LINE_BUF_SIZE);
+    if (!Buf) ExitWithError(nomem);
+    while (fgets(Buf, LINE_BUF_SIZE, InputFP)) {
+        if ((BoundaryCt > 0)
+             && (Buf[0] == '-')
+             && (Buf[1] == '-')
+             && PendingBoundary(Buf, Boundaries, &BoundaryCt)) {
+            break;
+        }
+        if (outfp) fputs(Buf, outfp);
+    }
+    free(Buf);
+}
+
+char *paramend(s)
+char *s;
+{
+    int inquotes=0;
+    while (*s) {
+        if (inquotes) {
+            if (*s == '"') {
+                inquotes = 0;
+            } else if (*s == '\\') {
+                ++s; /* skip a char */
+            }
+        } else if (*s == ';') {
+            return(s);
+        } else if (*s == '"') {
+            inquotes = 1;
+        }
+        ++s;
+    }
+    return(NULL);
+}        
+
+void
+ParseContentParameters(ct)
+char *ct;
+{
+    char *s, *t, *eq;
+
+    CParamsUsed = 0;
+    s = index(ct, ';');
+    if (!s) return;
+    *s++ = 0;
+    do {
+        t = paramend(s);
+        if (t) *t++ = 0;
+        eq = index(s, '=');
+        if (!eq) {
+            fprintf(stderr, "Ignoring unparsable content-type parameter: '%s'\n", s);
+            JunkParameter=Cleanse(s);
+        } else {
+            if (CParamsUsed >= CParamsAlloced) {
+                CParamsAlloced += 10;
+                if (CParams) {
+                    CParams = (char **) realloc(CParams, (1+CParamsAlloced) * sizeof (char *));
+                    CParamValues = (char **) realloc(CParamValues, (1+CParamsAlloced) * sizeof (char *));
+                } else {
+                    CParams = (char **) malloc((1+CParamsAlloced) * sizeof (char *));
+                    CParamValues = (char **) malloc((1+CParamsAlloced) * sizeof (char *));
+                }
+                if (!CParams || !CParamValues) ExitWithError(nomem);
+            }
+            *eq++ = 0;
+            s = Cleanse(s);
+            CParams[CParamsUsed] = s;
+            /* strip leading white space */
+            while (*eq && isspace((unsigned char) *eq)) ++eq;
+            /* strip trailing white space */
+            StripTrailingSpace(eq);
+            CParamValues[CParamsUsed++] = eq; 
+            if (DoDebug) printf("NEW PARAMETER: %s VALUE: %s\n", s, eq);
+        }
+        s = t;
+    } while (t);
+}
+
+char *FindParam(s)
+char *s;
+{
+    int i;
+    for (i=0; i<CParamsUsed; ++i) {
+        if (!strcmp(s, CParams[i])) {
+            return(CParamValues[i]);
+        }
+    }
+    return(NULL);
+}
+
+#ifdef MSDOS
+system2(s)
+char *s;
+{
+    printf("system2: \"%s\"\n", s);
+    return(0);
+}
+#endif
+
+strcatquoting(s1, s2)
+char *s1;
+char *s2;
+{
+    strcat(s1, s2);
+#ifdef NOTDEF
+    while (*s1) ++s1;
+    while (*s2) {
+        if (*s2 == '\"' || *s2 == '\\') *s1++ = '\\';
+        *s1++ = *s2++;
+    }
+    *s1 = '\0';
+#endif
+}
+
+PauseForUser() {
+#if defined(MSDOS) || defined(AMIGA)
+    char Buf[100];
+#endif
+
+    if (DefinitelyNotTty || MustNotBeTty) return;	
+#if defined(MSDOS) || defined(AMIGA)
+    printf("Press RETURN to go on\n");
+    gets(Buf);
+#else
+    fflush(stdout);
+    SaveTtyState();
+    if (StartRawStdin() != -1) {
+        printf("--Press any key to go on.--");
+    } else {
+        printf("Press RETURN to go on.\n");
+    }
+    fflush(stdout);
+    getchar();
+    RestoreTtyState();
+    printf("\n");
+#endif
+}
+
+StartRawStdin() {
+#if !defined(AMIGA) && !defined(MSDOS)
+#ifdef SYSV
+    struct termio   orterm, fterm;
+    ioctl(0, TCGETA, &orterm);	/* get current (i.e. cooked) termio */
+    fterm = orterm;		/* get termio to modify */
+
+    fterm.c_lflag &= ~ICANON;	/* clear ICANON giving raw mode */
+    fterm.c_cc[VMIN] = 1;	/* set MIN char count to 1 */
+    fterm.c_cc[VTIME] = 0;	/* set NO time limit */
+    return ioctl(0, TCSETAW, &fterm);	/* modify termio for raw mode */
+#else
+    struct sgttyb ts;
+    gtty(fileno(stdin), &ts);
+    ts.sg_flags |= RAW;
+    return stty(fileno(stdin), &ts);
+#endif
+#else
+    return(-1);
+#endif
+}
+
+
+int IsDirectory(fname)
+char *fname;
+{
+    struct stat stbuf;
+    if (stat(fname, &stbuf)) {
+	return(-1);
+    }
+    return (((stbuf.st_mode & S_IFMT) == S_IFDIR) ? 1 : 0);
+}
+
--- metamail-2.7.orig/src/metamail/uue.c
+++ metamail-2.7/src/metamail/uue.c
@@ -0,0 +1,124 @@
+#include <stdio.h>
+
+/*
+ * hack to metamail to decode uuencoded bodyparts
+ * Written by Keith Moore, February 1992
+ */
+
+uueget (ptr, outfp, n)
+char *ptr;
+FILE *outfp;
+{
+    unsigned char c1, c2, c3;
+    unsigned char p0, p1, p2, p3;
+
+    p0 = (ptr[0] - ' ') & 0x3F;
+    p1 = (ptr[1] - ' ') & 0x3F;
+    p2 = (ptr[2] - ' ') & 0x3F;
+    p3 = (ptr[3] - ' ') & 0x3F;
+    
+    c1 = p0 << 2 | p1 >> 4;
+    c2 = p1 << 4 | p2 >> 2;
+    c3 = p2 << 6 | p3;
+
+    if (n >= 1)
+	putc (c1, outfp);
+    if (n >= 2)
+	putc (c2, outfp);
+    if (n >= 3)
+	putc (c3, outfp);
+}
+
+
+getline (buf, size, fp)
+char *buf;
+int size;
+FILE *fp;
+{
+    int c;
+    char *ptr = buf;
+
+    for (c = 0; c < size; ++c)
+	buf[c] = ' ';
+    do {
+	c = getc (fp);
+	if (c == EOF) {
+	    *ptr = '\0';
+	    return (ptr == buf) ? -1 : 0;
+	}
+	else if (c == '\n' || c == '\r') {
+	    *ptr = '\0';
+	    return 0;
+	}
+	else if (ptr == buf && c == '>') /* ">From" line hack */
+	    continue;
+	else if (size > 0) {
+	    *ptr++ = c;
+	    size--;
+	}
+    } while (1);
+    return
+(0); /* shut lint up */
+}
+
+
+fromuue (infp, outfp, boundaries, ctptr)
+FILE *infp, *outfp;
+char **boundaries;
+int *ctptr;
+{
+    char buf[63];
+
+    while (1) {
+	if (getline (buf, sizeof buf, infp) < 0) {
+	    fprintf (stderr, "Premature EOF!\n");
+	    return;
+	}
+	if (strncmp (buf, "begin", 5) == 0)
+	    break;
+	else if (buf[0] == '-' && buf[1] == '-') {
+	    if (boundaries && PendingBoundary (buf, boundaries, ctptr))
+		return;
+	}
+    }	
+    while (1) {
+	if (getline (buf, sizeof buf, infp) < 0) {
+	    fprintf (stderr, "Premature EOF!\n");
+	    return;
+	}
+	else if (strncmp (buf, "end", 5) == 0)
+	    break;
+	else if (buf[0] == '-' && buf[1] == '-') {
+	    if (boundaries && PendingBoundary (buf, boundaries, ctptr)) {
+		fprintf (stderr, "premature end of x-uue body part\n");
+		return;
+	    }
+	    else {
+		fprintf (stderr, "ignoring invalid boundary marker\n");
+		continue;
+	    }
+        }
+        else if (*buf == '\0') continue;
+	else {
+	    int length = (*buf - ' ');
+	    if (*buf == '`')
+		length = 0;
+	    if (length < 0 || length > 63) {
+		fprintf (stderr, "fromuue: illegal length (%d)\n",
+			 length);
+	    }
+/* Nathan Maman recommends commenting out the next two lines */
+	    else if (length == 0)
+		break;
+	    else {
+		char *ptr = buf + 1;
+		while (length > 0) {
+		    uueget (ptr, outfp, length);
+		    length -= 3;
+		    ptr += 4;
+		}
+	    }
+	}
+    }
+}
+
--- metamail-2.7.orig/src/metamail/metamail.h
+++ metamail-2.7/src/metamail/metamail.h
@@ -0,0 +1,62 @@
+#ifndef METAMAIL_H
+#define METAMAIL_H
+
+#include <metamail/common.h>
+#include <metamail/patchlevel.h>
+
+BEGIN_C_DECLS
+
+#define CATCOMMAND  "cat"
+#define CATTEMPLATE "cat %s"
+#define METAMAIL    "metamail"
+
+#define WRITE_BINARY	"w"
+
+#define CMDSIZE 1200            /* Maximum size of command to execute */
+
+#define LINE_BUF_SIZE       2000
+
+//static char *nomem = "Out of memory!";
+extern char *mmversion;
+extern char *NoAskDefault;
+extern char *QuietDefault;
+extern char *tmproot;
+
+#define ENCODING_NONE 0
+#define ENCODING_BASE64 1
+#define ENCODING_QUOTEDPRINTABLE 2
+#define ENCODING_8BIT 3
+#define ENCODING_UUENCODE -1	/* non-standard */
+
+// for mailto.c (cutted and pasted ere)
+#define MINCHUNKSIZE 20000      /* Better be enough to hold the headers, or we
+				   die! */
+#define MAX_LINELENGTH  2000
+
+struct NoAskItem {
+    char *type;
+    struct NoAskItem *next;
+};
+
+extern char             *mailheaders;
+extern char             *MailerName;
+extern char             *ContentType;
+extern int               Quiet;
+extern struct NoAskItem *FirstNoAskItem;
+extern struct NoAskItem *FirstQuietItem;
+extern int               TransparentMode;
+extern int               RunAsRootOK;
+extern int               DoDebug;
+extern int               YankMode;
+extern int               MightAskBeforeExecuting;
+extern int               DefinitelyNotTty;
+extern int               MustNotBeTty;
+extern int               MaybePageOutput;
+
+END_C_DECLS
+
+#endif /* METAMAIL_H */
+
+
+
+
--- metamail-2.7.orig/src/metamail/environment.c
+++ metamail-2.7/src/metamail/environment.c
@@ -0,0 +1,181 @@
+/* Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
+
+Permission to use, copy, modify, and distribute this material 
+for any purpose and without fee is hereby granted, provided 
+that the above copyright notice and this permission notice 
+appear in all copies, and that the name of Bellcore not be 
+used in advertising or publicity pertaining to this 
+material without the specific, prior written permission 
+of an authorized representative of Bellcore.  BELLCORE 
+MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
+OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
+WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+*/
+
+/* environment.c - contains (nearly) everything for the environmenthandling
+   
+   Author: Michael Moerz <mikem@debian.org>
+*/
+
+#include "metamail.h"
+#include "environment.h"
+
+/** adds a string to the current environmet variable PATH
+    @param auxpath path to add to $PATH (=auxiliary path)
+*/
+void
+addToPath(auxpath)
+char *auxpath;
+{
+  if (auxpath && *auxpath) {    /* when pointer and auxpath[0] are != NULL */
+    static char *newpath = 0;    /* is needed! since it becomes part ov ENV */
+    char *oldpath = newpath;
+    char *path = getenv("PATH");
+    
+    if (!path) path = "";	 /* give a default if no current path */
+    newpath = XMALLOC(char, (7 + strlen(path) + strlen(auxpath)));
+    sprintf(newpath, "PATH=%s:%s", auxpath, path);
+    putenv(newpath);
+    if (oldpath) XFREE(oldpath); /* free up any old allocated PATH */
+  }
+}
+
+/** initialize global variable mailheaders from environment
+    this code is needed at several places -> own function
+*/
+void
+initMailHeadersFromEnvironment() {
+  mailheaders = getenv("MM_HEADERS");
+  if (mailheaders) {
+    char *s;
+    s = XMALLOC(char, 15+strlen(mailheaders));
+    sprintf(s, "MM_HEADERS=%s", mailheaders);
+    /* error? free mailheaders? */
+    mailheaders = s;
+  }
+}  
+
+/** initializes variables from environment variables or sets them to default
+    values if they are not found in the environment
+*/
+void
+initVarsFromEnvironment() {
+  char *QuietStr = NULL, *NoAskStr = NULL;
+
+  /* temporary directory - where all temporary files are created */
+  tmproot = getenv("METAMAIL_TMPDIR");
+  if (!tmproot) {
+    tmproot = XMALLOC(char, 5);
+    strcpy(tmproot, "/tmp");
+  }
+
+  /* */
+  initMailHeadersFromEnvironment();
+
+  /* the quietstring that can turn off output for various things */
+  QuietStr = getenv("MM_QUIET");
+  if (!QuietStr) /* when not set in the environment set default */
+    QuietStr = QuietDefault;
+  /* now either we are always quiet (="1") or we have to create a structure
+     containing information about when we have to be quiet
+  */
+  if (!strcmp(QuietStr, "1")) { /* when Quietstr == "1" */
+    Quiet = 1;
+  } else {
+    struct NoAskItem *qitem;
+    char *s, *tmp;
+    char *QuietCopy;
+
+    Quiet = 0;
+    QuietCopy = XMALLOC(char, 1+strlen(QuietStr));
+    strcpy(QuietCopy, QuietStr);
+    for (tmp=QuietCopy; *tmp; ++tmp) {
+      if (isupper((unsigned char) *tmp)) 
+	*tmp = tolower((unsigned char) *tmp);
+    }
+    do {
+      s = index(QuietCopy, ',');
+      if (s) *s++ = 0;
+      qitem = XMALLOC(struct NoAskItem, 1);
+      qitem->next = FirstQuietItem;
+      qitem->type = QuietCopy;
+      FirstQuietItem = qitem;
+      QuietCopy = s;
+    } while (QuietCopy);
+  }
+
+  /* */
+  if (getenv("MM_TRANSPARENT")) {
+    /* Will not propogate recursively */
+    TransparentMode = atoi(getenv("MM_TRANSPARENT"));
+  }
+
+  /* override for allowing to run as root -- DANGER WILL ROBINSON */
+  if (getenv("MM_RUNASROOT")) {
+    RunAsRootOK = atoi(getenv("MM_RUNASROOT"));
+  }
+
+  /* */
+  if (getenv("MM_YANKMODE")) {
+    /* Will not propogate recursively */
+    YankMode = atoi(getenv("MM_YANKMODE"));
+  }
+
+  /* debug flag */
+  if (getenv("MM_DEBUG")) {
+    DoDebug = atoi(getenv("MM_DEBUG"));
+  }
+
+  /* put that somewhere else */
+  if (DoDebug) 
+    printf("Metamail Version %s, debugging turned on.\n", mmversion);
+
+  /* similar to quiet */
+  NoAskStr = getenv("MM_NOASK");
+  if (!NoAskStr) /* when noask not set in the ENV then init to default */
+    NoAskStr = NoAskDefault;
+  if (!strcmp(NoAskStr, "1")) {
+    MightAskBeforeExecuting = 0;
+  } else {
+    struct NoAskItem *nai;
+    char *s, *tmp;
+    char *NoAskCopy;
+    
+    NoAskCopy = XMALLOC(char, 1+strlen(NoAskStr));
+    strcpy(NoAskCopy, NoAskStr);
+    for (tmp=NoAskCopy; *tmp; ++tmp) {
+      if (isupper((unsigned char) *tmp)) *tmp = tolower((unsigned char) *tmp);
+    }
+    do {
+      s = index(NoAskCopy, ',');
+      if (s) *s++ = 0;
+      nai = XMALLOC(struct NoAskItem, 1);
+      nai->next = FirstNoAskItem;
+      nai->type = NoAskCopy;
+      FirstNoAskItem = nai;
+      NoAskCopy = s;
+    } while (NoAskCopy);
+  }
+
+  /* hmm, perhaps mailprogram name ? */
+  MailerName = getenv("MM_MAILER");
+  if (!MailerName)
+    MailerName = "unknown";
+
+  /* */
+  if (getenv("MM_USEPAGER")) {
+    MaybePageOutput = atoi(getenv("MM_USEPAGER"));
+  }
+
+  /* setting if we have a tty or not */
+  if ((getenv("MM_NOTTTY") && ((atoi(getenv("MM_NOTTTY"))) != 0))) {
+    MustNotBeTty = 1;
+  }
+  if (MustNotBeTty
+      || !isatty(0)
+      || !isatty(1)) {
+    DefinitelyNotTty = 1;
+  }
+  
+  
+}
--- metamail-2.7.orig/src/metamail/environment.h
+++ metamail-2.7/src/metamail/environment.h
@@ -0,0 +1,11 @@
+#ifndef METAMAIL_ENVIRONMENT_H
+#define METAMAIL_ENVIRONMENT_H 1
+
+#define ENVIRONMENT_TMPROOT_DEFAULT_LEN 5
+#define ENVIRONMENT_TMPROOT_DEFAULT "/tmp"
+
+void addToPath                      (char *);
+void initMailHeadersFromEnvironment ();
+void initVarsFromEnvironment        ();
+
+#endif /* METAMAIL_ENVIRONMENT_H */
--- metamail-2.7.orig/src/metamail/mailto.c
+++ metamail-2.7/src/metamail/mailto.c
@@ -0,0 +1,2433 @@
+/*
+Copyright (c) 1992 Bell Communications Research, Inc. (Bellcore)
+
+Permission to use, copy, modify, and distribute this material 
+for any purpose and without fee is hereby granted, provided 
+that the above copyright notice and this permission notice 
+appear in all copies, and that the name of Bellcore not be 
+used in advertising or publicity pertaining to this 
+material without the specific, prior written permission 
+of an authorized representative of Bellcore.  BELLCORE 
+MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
+OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
+WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+*/
+
+/* 
+Program: mailto
+Author: Nathaniel S. Borenstein
+
+   This is a program that allows users to send MIME-format mail with much 
+   the same user interface as the Berkeley mail program.  
+
+   However, it should be stressed that this program includes
+   ABSOLUTELY NO CODE taken from Berkeley mail -- it is a 
+   "clean" reimplementation.
+
+   The user interface is directly modelled on Berkeley mail,
+   and the desiderata for its design are taken from the man
+   page for that program.
+
+   For information on using this program, consult the man page.
+
+STILL NEED TO DO/SUPPORT:
+
+-- Replace the main fgets call with something that allows in-line escape codes to do the equivalent of the tilde escapes.  Handle margins, centering, excerpts, EightBitMode, and RightToLeft mode properly.
+-- Replace EditString with something that does the right thing in-line.
+*/
+
+#include <metamail/common.h>
+
+#include <curses.h>  /* This and next for tgetstr(3X) and kin */
+#include <term.h>
+
+#include "metamail.h"
+#include "metamail_default.h"
+
+struct mailpart *CreateNewPart();
+char *getmyname(); /* Defined in shared.c */
+
+
+/* The main data structure for the multiple parts of the mail */
+
+struct mailpart {
+    int istext;
+    int isrich;
+    char *content_type;
+    int encoding_type_needed;
+    char *filename;
+    struct MailcapEntry *mc;
+    struct mailpart *next, *prev;
+};
+
+/* Some globals */
+struct mailpart *FirstPart = NULL;
+static char *Subject = NULL, *ToList = NULL, *CCList= NULL, *InReplyTo = NULL;
+FILE *fpout = NULL;
+static char *CharacterSet = NULL;
+static int PartEndsWithNewline=1;
+static int SplitSize=DEFAULT_SPLIT_SIZE;
+
+char *deadLetter = "dead.letter";
+char *signature = ".signature";
+char *mimeSignature = ".SIGNATURE";
+#define TMPFILE_NAME_SIZE   1000
+#define FILE_NAME_SIZE      1000
+
+#define DEFAULT_EDITOR      "vi"
+
+#define SYSTEM(command)     system(command);
+
+
+/* The following are the globals that can be set via .mailrc */
+int  V_askcc=0, /* To ask about the Cc field */
+     V_dot=0, /* To take a period as the end of input */
+     V_ignore=0, /* To ignore interrupts */
+     V_verbose=0, /* To run sendmail with -v */
+     V_quiet=0, /* To suppress various informational output */
+     V_keepblind=0, /* To receive a blind copy of outgoing mail. */
+     V_commasonly=0; /* To suppress using spaces as address separators */
+
+/* Codes for encoding_type_needed */
+#define ENC_NONE 0
+#define ENC_QP 1 /* quoted-printable */
+#define ENC_B64 2 /* base64 */
+
+/* Codes for JustificationState */
+#define JUST_LEFT 0
+#define JUST_RIGHT 1
+#define JUST_CENTER 2
+int JustificationState = JUST_LEFT;
+
+
+EightBitCharHelp() {
+    if (!CharacterSet || !strcmp(CharacterSet, "us-ascii")) {
+        printf("There are no extended characters available for your US-ASCII terminal.\n\n");
+        printf("If you are actually using a terminal or terminal emulator with a richer\ncharacter set, you must use the '-a' option or the 'MM_CHARSET' environment\nvariable to inform this program of that fact.\n");
+    } else {
+        static char *kbd1[] =
+          {
+            "1234567890-=",
+            "qwertyuiop[]",
+            "asdfghjkl;'`",
+            "zxcvbnm,./\\",
+            NULL
+        };
+        static char *kbd2[] = /* MUST have same # of entries as kbd1 */
+          {
+            "!@#$%^&*()_+",
+            "QWERTYUIOP{}",
+            "ASDFGHJKL:\"~",
+            "ZXCVBNM<>?|",
+            NULL
+        };
+        char *s;
+        int i, ct;
+
+        printf("Here is the keyboard map for the character set %s\n.If your terminal does not really use this character set, this may look strange.\n\n", CharacterSet);
+        for (i=0; kbd1[i]; ++i) {
+            for (ct=0, s=kbd1[i]; *s; ++s) {
+                printf("%c%c ", *s, (*s) + 128);
+                ct+=3;
+            }
+            while (ct++<40) printf(" ");
+            for (s=kbd2[i]; *s; ++s) {
+                printf("%c%c ", *s, (*s) + 128);
+            }
+            printf("\n");
+        }
+    }
+}            
+
+char *
+tmpname() {
+    char *s = malloc(30);
+    if (!s) nomemabort();
+    {
+        char *tmproot = getenv("METAMAIL_TMPDIR");
+        if (!tmproot) tmproot="/tmp";
+        if (strlen(tmproot) > 19) {
+            free(s);
+            s=malloc(12+strlen(tmproot));
+            if (!s) nomemabort();
+        }
+        sprintf(s, "%s/mm.XXXXXX", tmproot);
+    }
+    return(s);
+}
+
+TildeHelp() {
+    char *pager = getenv("PAGER");
+    char TmpName[100], CmdBuf[150];
+    FILE *fp;
+
+    strcpy(TmpName, tmpname());
+    fp = fdopen(mkstemp(TmpName), "w");
+    if (!fp) fp = stdout;
+    fprintf(fp, "The following tilde escapes are BSD-mail-compatible:\n");
+    fprintf(fp, "~? Show help on tilde escapes\n");
+    fprintf(fp, "~| RESERVED FOR BSD MAIL COMPATIBILITY\n");
+    fprintf(fp, "~f RESERVED FOR BSD MAIL COMPATIBILITY\n");
+    fprintf(fp, "~m RESERVED FOR BSD MAIL COMPATIBILITY\n");
+    fprintf(fp, "~! Shell escape\n");
+    fprintf(fp, "~~ Enter text line starting with a tilde\n");
+    fprintf(fp, "~. Send the mail and exit\n");
+    fprintf(fp, "~c Add to Cc list\n");
+    fprintf(fp, "~d Read from %s (or named file, ~d filename)\n", deadLetter);
+    fprintf(fp, "~e Edit message being composed\n");
+    fprintf(fp, "~h Edit the headers\n");
+    fprintf(fp, "~p Print out the message so far\n");
+    fprintf(fp, "~q Quit, copying to %s\n", deadLetter);
+    fprintf(fp, "~r Read the named text file into the message\n");
+    fprintf(fp, "~s Reset the subject\n");
+    fprintf(fp, "~t Add to To list\n");
+    fprintf(fp, "~v Edit using VISUAL editor\n");
+    fprintf(fp, "~w Write message to named file\n");
+    fprintf(fp, "\n");
+    fprintf(fp, "The following tilde escapes are unique to this program:\n");
+    fprintf(fp, "~/<number> Set maximum size before message is split into multiple parts\n");
+    fprintf(fp, "~?+ Show help on extended (eight-bit) characters\n");
+    fprintf(fp, "~> Indent Left Margin\n");
+    fprintf(fp, "~< Unindent Left Margin\n");
+    fprintf(fp, "~<R Indent Right Margin\n");
+    fprintf(fp, "~>R Unindent Right Margin\n");
+    fprintf(fp, "~+ Enter 8-bit mode for non-ASCII characters\n");
+    fprintf(fp, "~- Leave 8-bit mode (return to ASCII)\n");
+    fprintf(fp, "~^ Toggle \"Upside-down\" (right-to-left) mode.\n");
+    fprintf(fp, "~* Add non-text data (pictures, sounds, etc.) as a new MIME part (try it!)\n");
+    fprintf(fp, "~b Toggle bold mode\n");
+    fprintf(fp, "~i Toggle italic mode\n");
+    fprintf(fp, "~j Alter Justification (~jc = center, ~jl = flushleft, ~jr = flushright.)\n");
+    fprintf(fp, "~k Toggles whether or not to keep a 'blind' copy of your mail\n");
+    fprintf(fp, "~n Force newline (hard line break)\n");
+    fprintf(fp, "~Q Toggle quotation (excerpt) mode\n");
+    fprintf(fp, "~S Toggle Semitic text mode (combines 8-bit and left-to-right)\n");
+    fprintf(fp, "~u Toggle underline mode\n");
+    fprintf(fp, "~z Add the contents of %s as a TEXT signature.\n", signature);
+    fprintf(fp, "~Z Add the contents of %s as a NON-TEXT (MIME-format) signature.\n", mimeSignature);
+    fprintf(fp, "For further information, read the man page.\n");
+    fprintf(fp, "\n");
+    if (fp != stdout) {
+        fclose(fp);
+        snprintf(CmdBuf, sizeof(CmdBuf), "%s %s", pager ? pager : "sensible-pager", TmpName);
+        SYSTEM(CmdBuf);
+        unlink(TmpName);
+    }
+}
+
+char *gethome() {
+    struct passwd *p = getpwuid(getuid());
+    if (!p || !p->pw_dir) {
+        perror("Cannot find your home directory, using /tmp");
+        return("/tmp");
+    }
+    return (p->pw_dir);
+}
+
+
+static char standoutbuf[50], standendbuf[50], StartUnderline[50], StopUnderline[50], BoldOn[50], BoldOff[50], KS[50], KE[50];
+static int termcolumns, termrows;
+
+InitTerminal() {
+    char tbuf[1024], *term, *dum;
+
+    term = getenv("TERM");
+    if (term && tgetent(tbuf, term) != 1) {
+        term = NULL;
+    }
+    if (term) {
+        dum = KS;
+        if (tgetstr("ks", &dum)) *dum = '\0'; else KS[0] = '\0';
+        dum = KE;
+        if (tgetstr("ke", &dum)) *dum = '\0'; else KE[0] = '\0';
+        dum = standoutbuf;
+        if (tgetstr("so", &dum)) *dum = '\0'; else standoutbuf[0] = '\0';
+        dum = standendbuf;
+        if (tgetstr("se", &dum)) *dum = '\0'; else standendbuf[0] = '\0';
+        dum = BoldOn;
+        if (tgetstr("md", &dum)) *dum = '\0'; else strcpy(BoldOn, standoutbuf);
+        dum = BoldOff;
+        if (tgetstr("me", &dum)) *dum = '\0'; else strcpy(BoldOff, standendbuf);
+        dum = StartUnderline;
+        if (tgetstr("us", &dum)) *dum = '\0'; else StartUnderline[0] = '\0';
+        dum = StopUnderline;
+        if (tgetstr("ue", &dum)) *dum = '\0'; else StopUnderline[0] = '\0';
+        termcolumns = tgetnum("co");
+        if (termcolumns <= 0) termcolumns = 80;
+        termrows = tgetnum("li");
+        if (termrows <= 0) termrows = 23;
+    } else {
+        KS[0] = '\0';
+        KE[0] = '\0';
+        standoutbuf[0] = '\0';
+        standendbuf[0] = '\0';
+        BoldOn[0] = '\0';
+        BoldOff[0] = '\0';
+        StartUnderline[0] = '\0';
+        StopUnderline[0] = '\0';
+        termcolumns = 80;
+        termrows = 23;
+    }
+    fputs(KS, stdout);
+}
+
+FinalizeTerminal() {
+    tfputs(standendbuf);
+    tfputs(BoldOff);
+    tfputs(StopUnderline);
+}
+
+struct mailpart *
+NewPart() {
+    struct mailpart *p;
+    p = (struct mailpart *) malloc(sizeof(struct mailpart));
+    if (!p) nomemabort();
+    p->istext = 1;
+    p->isrich = 0;
+    p->content_type = "text/plain";
+    p->encoding_type_needed = ENC_NONE;
+    p->filename = tmpname();
+    p->mc = NULL;
+    p->next = NULL;
+    p->prev = NULL;
+    return(p);
+}
+
+nomemabort() {
+    fprintf(stderr, "mailto: Out of memory\n");
+    cleanexit(-1);
+}
+
+char *
+freshcopy(s)
+char *s;
+{
+    char *t = malloc(1+strlen(s));
+    if (!t) nomemabort();
+    strcpy(t, s);
+    return(t);
+}
+
+char *
+GetLineMalloced(prompt, def)
+char *prompt, *def;
+{
+    char Sbuf[1000], *ans;
+    printf("%s: ", prompt);
+    fflush(stdout);
+    ans = fgets(Sbuf, sizeof(Sbuf), stdin);
+    if (ans) {
+        /* Need a fresh copy */
+        ans = malloc(1+strlen(Sbuf));
+        if (!ans) nomemabort();
+        strcpy(ans, Sbuf);
+        ans[strlen(ans) - 1] = '\0'; /* trash newline */
+    } else {
+        /* Callers will free() this, so make a fresh copy as well */
+        ans = malloc(1+strlen(def));
+        if (!ans) nomemabort();
+        strcpy(ans, def);
+    }
+    return(ans);
+}
+
+char *
+EditString(prompt, s)
+char *prompt, *s;
+{
+    char *ans;
+    char NewPrompt[500];
+    if (!s) s = "";
+    snprintf(NewPrompt, sizeof(NewPrompt), "%s [%s]", prompt, s);
+    ans = GetLineMalloced(NewPrompt, s);
+    while (*ans && isspace((unsigned char) *ans)) ++ans;
+    if (!*ans) return(s);
+    return(ans);
+}
+
+char *
+AddCommasToAddressList(s)
+char *s;
+{
+    int spaces = 0;
+    char *t, *ans, *ansptr;
+
+    if (V_commasonly) {
+        ans = malloc(1+strlen(s));
+        if (!ans) nomemabort;
+        strcpy(ans, s);
+        return(ans);
+    }
+    for (t=s; *t; ++t) {
+        if (*t == ' ') ++spaces;
+    }
+    /* That provides a max size for the mallocs */
+    ans = malloc(1+strlen(s) +spaces);
+    if (!ans) nomemabort();
+    ansptr = ans;
+    for (t=s; *t; ++t) {
+        if (*t == ' ' && *(t-1) != ',') {
+            *ansptr++ = ',';
+        }
+        *ansptr++ = *t;
+    }
+    *ansptr = '\0';
+    while (--ansptr > ans && (isspace((unsigned char) *ansptr) || *ansptr == ',')) {
+        *ansptr = '\0';
+    }
+    return(ans);
+}
+
+char *
+AddToList(List, entry, definitelynew)
+char *List, *entry;
+int definitelynew;
+{
+    int len;
+    char *end = entry+strlen(entry);
+
+    while (--end >= entry && isspace((unsigned char) *end)) *end = '\0';
+    if (! *entry) return(List);
+    if (List && *List) {
+        List = realloc(List, strlen(List) + strlen(entry) + 5);
+        if (!List) nomemabort();
+        if (V_commasonly && !definitelynew) {
+            strcat(List, " ");
+        } else {
+            strcat(List, ", ");
+        }
+        strcat(List, entry);
+    } else {
+        List = malloc(strlen(entry) + 2);
+        if (!List) nomemabort();
+        strcpy(List, entry);
+    }
+    len = strlen(List);
+    while (List[--len] == ',') List[len] = '\0';
+    return(List);
+}
+
+main(argc, argv)
+char **argv;
+{
+    char *sdum, *LineBuf, CmdBuf[100];
+    int i, EightBitMode = 0, RightToLeftMode = 0, AllDone=0, EightBitSeen=0, prevaddrdone=1;
+    FILE *fpin;
+    struct mailpart *CurrentPart=NULL;
+
+    if ((LineBuf = malloc(MAX_LINELENGTH)) == NULL) {
+        fprintf(stderr, "mailto: Unable to allocate memory\n");
+        exit(10);
+    }
+    ProcessInitFiles();
+    InitSignals();
+    InitTerminal();
+    sdum = getenv("SPLITSIZE");
+    if (sdum) {
+        i = atoi(sdum);
+        if (i < MINCHUNKSIZE) {
+            fprintf(stderr, "Ignoring SPLITSIZE environment variable of %d -- the minimum value is %d\n", i, MINCHUNKSIZE);
+        } else {
+            SplitSize = i;
+        }
+    }
+
+    CharacterSet = getenv("MM_CHARSET");
+    for (i=1; i<argc; ++i) {
+        if (argv[i][0] == '-') {
+            switch (argv[i][1]) {
+                case 'a':
+                    if (argv[i][2]) {
+                        CharacterSet = &argv[i][2];
+                    } else if (++i < argc) {
+                        CharacterSet = argv[i];
+                    } else {
+                        fprintf(stderr, "mailto: -a requires a character set specification to follow\n");
+                        cleanexit(-1);
+                    }
+                    break;
+                case 'c':
+                    if (argv[i][2]) {
+                        CCList = &argv[i][2];
+                    } else if (++i < argc) {
+                        CCList = argv[i];
+                    } else {
+                        CCList = "";
+                    }
+                    break;
+                case 'r':
+                    if (argv[i][2]) {
+                        InReplyTo = &argv[i][2];
+                    } else if (++i < argc) {
+                        InReplyTo = argv[i];
+                    } else {
+                        fprintf(stderr, "mailto: -r requires a Message-ID to follow\n");
+                        cleanexit(-1);
+                    }
+                    break;
+                case 's':
+                    if (argv[i][2]) {
+                        Subject = &argv[i][2];
+                    } else if (++i < argc) {
+                        Subject = argv[i];
+                    } else {
+                        fprintf(stderr, "mailto: -s requires a subject specification to follow\n");
+                        cleanexit(-1);
+                    }
+                    break;
+                default:
+                    fprintf(stderr, "mailto:  Unrecognized option %s\n", argv[i]);
+                    cleanexit(-1);
+            }
+        } else {
+            /* It's an address, I guess */
+            ToList = AddToList(ToList, argv[i], prevaddrdone);
+            prevaddrdone = (argv[i][strlen(argv[i]) -1] == ',') ? 1 : 0;
+        }
+    }
+    if (!CharacterSet) CharacterSet = "us-ascii";
+    for (sdum = CharacterSet; *sdum; ++sdum) {
+        if (isupper(*sdum)) *sdum = tolower(*sdum);
+    }
+    if (strcmp(CharacterSet, "us-ascii")
+	 && strcmp(CharacterSet, "kio8-r")
+	 && strncmp(CharacterSet, "iso-8859-", 9)) {
+        fprintf(stderr, "mailto:  Unsupported character set: %s\n", CharacterSet);
+        exit(-1);
+    }
+    if (strcmp(CharacterSet, "us-ascii")) {
+        printf("Composing mail in character set %s\n", CharacterSet);
+    }
+    ProcessMailcapFiles();
+    if (!ToList) {
+        sdum=GetLineMalloced("To", "");
+        ToList=AddCommasToAddressList(sdum);
+        free(sdum);
+    }
+    if (!Subject) Subject=GetLineMalloced("Subject", "<NO SUBJECT>");
+    if (!CCList && V_askcc) {
+        sdum = GetLineMalloced("Cc", "");
+        CCList = AddCommasToAddressList(sdum);
+        free(sdum);
+    }
+    FirstPart = NewPart();
+    CurrentPart = FirstPart;
+    fpout = fdopen(mkstemp(CurrentPart->filename), "w");
+    if (!fpout) {
+        fprintf(stderr, "mailto:  Can't open temporary file %s\n", CurrentPart->filename);
+        cleanexit(-1);
+    }
+    while (!AllDone && fgets(LineBuf, MAX_LINELENGTH, stdin) != NULL) {
+        if (V_dot && LineBuf[0] == '.' && LineBuf[1] == '\n') {
+            AllDone = 1;
+        } else if (LineBuf[0] == '~') {
+            /* Clean up argument */
+            char *start = LineBuf+2;
+            char *end = start + strlen(start);
+            while (--end > start && isspace((unsigned char) *end)) *end = '\0';
+            while (isspace((unsigned char) *start)) ++start;
+            switch (LineBuf[1]) {
+                case '.':
+                    AllDone = 1;
+                    break;
+                case '?':
+                    if (*start == '+') {
+                        EightBitCharHelp();
+                    } else {
+                        TildeHelp();
+                    }
+                    break;
+                case '~':
+                    FputsQuotingLT(LineBuf+1, fpout, CurrentPart, EightBitMode, RightToLeftMode);
+                    break;
+                case '!':
+                    if (!V_quiet) printf("Executing: %s\n", start);
+                    SYSTEM(start);
+                    break;
+                case '>':
+                    CurrentPart->isrich = 1;
+                    fputs("<nl>", fpout);
+                    if (*start=='r' || *start == 'R') {
+                        TryClosingStyle("indentright", fpout, CurrentPart);
+                    } else {
+                        TryOpeningStyle("indent", fpout, CurrentPart, NULL);
+                    }
+                    break;
+                case '<':
+                    CurrentPart->isrich = 1;
+                    fputs("<nl>", fpout);
+                    if (*start == 'R' || *start == 'r') {
+                        TryOpeningStyle("indentright", fpout, CurrentPart, NULL);
+                    } else {
+                        TryClosingStyle("indent", fpout, CurrentPart);
+                    }
+                    break;
+                case '/':
+                    i = atoi(start);
+                    if (i < MINCHUNKSIZE) {
+                        fprintf(stderr, "Ignoring splitsize setting of %d -- the minimum value is %d\n", i, MINCHUNKSIZE);
+                    } else {
+                        SplitSize = i;
+                        if (!V_quiet) printf("Set splitsize to %d\n", i);
+                    }
+                    break;
+                case '+':
+                    if (!strcmp(CharacterSet, "us-ascii")) {
+                        fprintf(stderr, "mailto:  No 8-bit characters allowed in ASCII mail\n");
+                    } else {
+                        EightBitMode = 1;
+                        if (!V_quiet) printf("Entering text in eight-bit mode\n");
+                    }
+                    break;
+                case '-':
+                    EightBitMode = 0;
+                    if (!V_quiet) printf("Entering text in seven-bit (normal) mode\n");
+                    break;
+                case '^':
+                    RightToLeftMode = ! RightToLeftMode;
+                    if (!V_quiet) printf("%s right-to-left mode\n", RightToLeftMode ? "Entering" : "Exiting");
+                    break;
+                case '*':
+                    {
+                    struct mailpart *p = CreateNewPart();
+                    if (!p) break;
+                    TempCloseStyles(fpout);
+                    fclose(fpout);
+                    CurrentPart->next = p;
+                    CurrentPart->next->prev = CurrentPart;
+                    CurrentPart = CurrentPart->next;
+                    CurrentPart->next = NewPart();
+                    CurrentPart->next->prev = CurrentPart;
+                    CurrentPart = CurrentPart->next;
+                    fpout = fdopen(mkstemp(CurrentPart->filename), "w");
+                    if (!fpout) {
+                        fprintf(stderr, "mailto:  Can't open temporary file %s\n", CurrentPart->filename);
+                        cleanexit(-1);
+                    }
+                    ReopenStyles(fpout, CurrentPart);
+                    break;
+                    }
+                case 'b':
+                    ToggleStyle("bold", fpout, CurrentPart, BoldOn, BoldOff);
+                    break;
+                case 'c':
+                    CCList = AddToList(CCList, start, 1);
+                    if (!V_quiet) printf("Cc field is now: %s\n", CCList);
+                    break;
+                case 'd':
+                    {
+                    char fnam[FILE_NAME_SIZE];
+                    if (! *start) {
+                        snprintf(fnam, sizeof(fnam), "%s/dead.letter", gethome());
+                    } else {
+                        strcpy(fnam, start);
+                    }
+                    fpin = fopen(fnam, "r");
+                    if (!fpin) {
+                        fprintf(stderr, "mailto: Cannot open file %s\n", fnam);
+                        break;
+                    }
+                    TempCloseStyles(fpout);
+                    fclose(fpout);
+                    CurrentPart->next = NewPart();
+                    CurrentPart->next->prev = CurrentPart;
+                    CurrentPart = CurrentPart->next;
+                    CurrentPart->istext = 0;
+                    CurrentPart->content_type = "message/rfc822";
+                    fpout = fdopen(mkstemp(CurrentPart->filename), "w");
+                    if (!fpout) {
+                        fprintf(stderr, "mailto: Cannot open temporary file %s\n", CurrentPart->filename);
+                        break;
+                    }
+                    (void) TranslateInputToEncodedOutput(fpin, fpout, ENC_NONE, "");
+                    fclose(fpin);
+                    fclose(fpout);
+                    printf("Included contents of %s\n(continue)\n", fnam);
+                    CurrentPart->next = NewPart();
+                    CurrentPart->next->prev = CurrentPart;
+                    CurrentPart = CurrentPart->next;
+                    fpout = fdopen(mkstemp(CurrentPart->filename), "w");
+                    if (!fpout) {
+                        fprintf(stderr, "mailto:  Can't open temporary file %s\n", CurrentPart->filename);
+                        cleanexit(-1);
+                    }
+                    ReopenStyles(fpout, CurrentPart);
+                    break;
+                    }
+                case 'e':
+                    EditCurrentMessage(0);
+                    break;
+                case 'h':
+                    ToList = AddCommasToAddressList(EditString("To", ToList));
+                    Subject = EditString("Subject", Subject);
+                    CCList = AddCommasToAddressList(EditString("Cc", CCList));
+                    break;
+                case 'i':
+                    ToggleStyle("italic", fpout, CurrentPart, standoutbuf, standendbuf);
+                    break;
+                case 'j':
+                    {
+                    int NewJustificationState;
+                    switch (*start) {
+                        case 'c':
+                        case 'C':
+                            NewJustificationState = JUST_CENTER;
+                            break;
+                        case 'r':
+                        case 'R':
+                            NewJustificationState = JUST_RIGHT;
+                            break;
+                        case 'l':
+                        case 'L':
+                            NewJustificationState = JUST_LEFT;
+                            break;
+                        default:
+                            printf("mailto: Unrecognized justification state: %c\n", *start);
+                            NewJustificationState = JustificationState;
+                    }
+                    if (JustificationState == NewJustificationState) {
+                        if (!V_quiet) printf("mailto:  No change in justificiation\n");
+                    } else {
+                        if (CurrentPart->isrich) {
+                            if (JustificationState == JUST_CENTER) {
+                                EndStyle(fpout, "center");
+                            } else if (JustificationState == JUST_RIGHT) {
+                                EndStyle(fpout, "flushright");
+                            } else {
+                                EndStyle(fpout, "flushleft");
+                            }
+                        }
+                        CurrentPart->isrich = 1;
+                        fputs("<nl>", fpout);
+                        JustificationState = NewJustificationState;
+                        if (JustificationState == JUST_CENTER) {
+                            StartStyle(fpout, "center", NULL);
+                        } else if (JustificationState == JUST_RIGHT) {
+                            StartStyle(fpout, "flushright", NULL);
+                        } else {
+                            StartStyle(fpout, "flushleft", NULL);
+                        }
+                    }
+                    break;
+                    }
+                case 'k':
+                    V_keepblind = ! V_keepblind;
+                    if (!V_quiet) printf("%s keep a blind copy of this message\n", V_keepblind ? "Will" : "Won't");
+                    break;
+                case 'n':
+                    CurrentPart->isrich = 1;
+                    fputs("<nl>", fpout);
+                    if (!V_quiet) printf("Inserted line break\n");
+                    break;
+                case 'p':
+                    {
+                    FILE *fptmp;
+                    char Cmd[TMPFILE_NAME_SIZE + 15];
+                    char *s=tmpname();
+                    fclose(fpout);
+                    fptmp = fdopen(mkstemp(s), "w");
+                    WriteOutMessage(fptmp, ToList, Subject, CCList, FirstPart);
+                    TempCloseStyles(fptmp);
+                    fclose(fptmp);
+                    fpout = fopen(CurrentPart->filename, "a");
+                    if (!fpout) {
+                        fprintf(stderr, "mailto:  Can't open temporary file %s\n", CurrentPart->filename);
+                        cleanexit(-1);
+                    }
+                    snprintf(Cmd, sizeof(Cmd), "metamail -z %s", s);
+                    SYSTEM(Cmd);
+                    free(s);
+                    RestoreCurrentStyles();
+                    break;
+                    }
+                case 'q':
+                    TempCloseStyles(fpout);
+                    fclose(fpout);
+                    if (!WriteDeadLetter()) cleanexit(0);
+                    break;
+                case 'Q':
+                    ToggleStyle("excerpt", fpout, CurrentPart, NULL, NULL);
+                    break;
+                case 'r':
+                    if (! *start) {
+                        printf("mailto: No file name given.\n");
+                        break;
+                    }
+                    fpin = fopen(start, "r");
+                    if (!fpin) {
+                        fprintf(stderr, "mailto: Cannot open file %s\n", start);
+                        break;
+                    }
+                    EightBitSeen = TranslateInputToEncodedOutput(fpin, fpout, ENC_NONE, "");
+                    if (EightBitSeen 
+                         && (CurrentPart->istext || CurrentPart->isrich)) {
+                        if (CurrentPart->encoding_type_needed == ENC_NONE) {
+                            CurrentPart->encoding_type_needed = ENC_QP;
+                        }
+                        if (!strcmp(CharacterSet, "us-ascii")) {
+                            SwitchToEuropean();
+                        }
+                    }
+                    fclose(fpin);
+		    if (!V_quiet) printf("Included contents of %s\n", start);
+		    printf("(continue)\n");
+                    break;
+                case 'S':
+                    /* Semitic language mode toggle */
+                    if (EightBitMode) {
+                        EightBitMode = 0;
+                        RightToLeftMode = 0;
+                    } else {
+                        if (!strcmp(CharacterSet, "us-ascii")) {
+                            fprintf(stderr, "mailto:  No 8-bit characters allowed in ASCII mail\n");
+                            break;
+                        }
+                        EightBitMode = 1;
+                        RightToLeftMode = 1;
+                    }
+                    if (!V_quiet) printf("%s Eight-bit and right-to-left modes\n", RightToLeftMode ? "Entering" : "Exiting");
+                    break;
+                case 's':
+                    {
+                    char *subj=start;
+                    if (*subj) {
+                        Subject = freshcopy(subj);
+                    } else {
+                        Subject=GetLineMalloced("Subject", "<NO SUBJECT>");
+                    }
+                    break;
+                    }
+                case 't':
+                    ToList = AddToList(ToList, start, 1);
+                    if (!V_quiet) printf("To field is now: %s\n", ToList);
+                    break;
+                case 'u':
+                    ToggleStyle("underline", fpout, CurrentPart, StartUnderline, StopUnderline);
+                    break;
+                case 'v':
+                    EditCurrentMessage(1);
+                    break;
+                case 'w':
+                    {
+                    FILE *fptmp;
+                    char *fname;
+                    fclose(fpout);
+                    fname = start;
+                    fptmp = fopen(fname, "w");
+                    WriteOutMessage(fptmp, ToList, Subject, CCList, FirstPart);
+                    TempCloseStyles(fptmp);
+                    if(fclose(fptmp)) {
+                        fprintf(stderr, "Could not write file %s\n", fname);
+                    } else {
+                        printf("Wrote draft to %s\n", fname);
+                    }
+                    fpout = fopen(CurrentPart->filename, "a");
+                    if (!fpout) {
+                        fprintf(stderr, "mailto:  Can't open temporary file %s\n", CurrentPart->filename);
+                        cleanexit(-1);
+                    }
+                    break;
+                    }
+                case 'z':
+                    {
+                    char FBuf[FILE_NAME_SIZE];
+                    if (! *start) {
+                        snprintf(FBuf, sizeof(FBuf), "%s/.signature", gethome());
+                    } else {
+                        strcpy(FBuf, start);
+                    }
+                    fpin = fopen(FBuf, "r");
+                    if (!fpin) {
+                        fprintf(stderr, "mailto: Cannot open file %s\n", FBuf);
+                        break;
+                    }
+                    CurrentPart->isrich = 1;
+                    StartStyle(fpout, "signature", NULL);
+                    EightBitSeen = TranslateInputToEncodedOutput(fpin, fpout, ENC_NONE, "");
+                    if (EightBitSeen) {
+                        if (CurrentPart->encoding_type_needed == ENC_NONE) {
+                            CurrentPart->encoding_type_needed = ENC_QP;
+                        }
+                        if ((CurrentPart->istext || CurrentPart->isrich) && !strcmp(CharacterSet, "us-ascii")) {
+                            SwitchToEuropean();
+                        }
+                    }
+                    fclose(fpin);
+                    EndStyle(fpout, "signature");
+                    if (!V_quiet) printf("Included contents of %s\n", FBuf);
+		    printf("(continue)\n");
+                    break;
+                    }
+                case 'Z':
+                    {
+                    char fnam[FILE_NAME_SIZE];
+                    if (! *start) {
+                        snprintf(fnam, sizeof(fnam), "%s/.SIGNATURE", gethome());
+                    } else {
+                        strcpy(fnam, start);
+                    }
+                    fpin = fopen(fnam, "r");
+                    if (!fpin) {
+                        fprintf(stderr, "mailto: Cannot open file %s\n", fnam);
+                        break;
+                    }
+                    TempCloseStyles(fpout);
+                    fclose(fpout);
+                    CurrentPart->next = NewPart();
+                    CurrentPart->next->prev = CurrentPart;
+                    CurrentPart = CurrentPart->next;
+                    CurrentPart->istext = 0;
+                    CurrentPart->content_type = "message/rfc822";
+                    fpout = fdopen(mkstemp(CurrentPart->filename), "w");
+                    if (!fpout) {
+                        fprintf(stderr, "mailto: Cannot open temporary file %s\n", CurrentPart->filename);
+                        break;
+                    }
+                    EightBitSeen = TranslateInputToEncodedOutput(fpin, fpout, ENC_NONE, "");
+                    if (EightBitSeen &&
+                        (CurrentPart->istext || CurrentPart->isrich)) {
+                        if (CurrentPart->encoding_type_needed == ENC_NONE) {
+                            CurrentPart->encoding_type_needed = ENC_QP;
+                        }
+                        if (!strcmp(CharacterSet, "us-ascii")) {
+                            SwitchToEuropean();
+                        }
+                    }
+                    fclose(fpin);
+                    fclose(fpout);
+                    printf("Included contents of %s\n", fnam);
+		    printf("(continue)\n");
+                    CurrentPart->next = NewPart();
+                    CurrentPart->next->prev = CurrentPart;
+                    CurrentPart = CurrentPart->next;
+                    fpout = fdopen(mkstemp(CurrentPart->filename), "w");
+                    if (!fpout) {
+                        fprintf(stderr, "mailto:  Can't open temporary file %s\n", CurrentPart->filename);
+                        cleanexit(-1);
+                    }
+                    ReopenStyles(fpout, CurrentPart);
+                    break;
+                    }
+                default:
+                    printf("Unrecognized tilde escape: %c\n", LineBuf[1]);
+                    break;
+            }
+        } else {
+            FputsQuotingLT(LineBuf, fpout, CurrentPart, EightBitMode, RightToLeftMode);
+        }
+    }
+    TempCloseStyles(fpout);
+    fclose(fpout);
+    printf("EOT\n");
+    if (V_verbose) {
+        snprintf(CmdBuf, sizeof(CmdBuf), "splitmail -d -v -s %d", SplitSize);
+    } else {
+        snprintf(CmdBuf, sizeof(CmdBuf), "splitmail -d -s %d", SplitSize);
+    }
+    fpout = popen(CmdBuf, "w");
+    if (!fpout) {
+        fprintf(stderr, "mailto: Can't write to splitmail\n");
+        (void) WriteDeadLetter();
+        cleanexit(-1);
+    }
+    WriteOutMessage(fpout, ToList, Subject, CCList, FirstPart);
+    if (ferror(fpout) || pclose(fpout)) {
+        perror("mailto: Error writing to splitmail");
+        (void) WriteDeadLetter();
+        cleanexit(-1);
+    }
+    cleanexit(0); /* Never returns */
+}
+
+char *newid() {
+    static char idbuf[100];
+    static int ctr=0;
+
+    snprintf(idbuf, sizeof(idbuf), "<%d_%d_%d_%d@%s>", (int) getuid(), (int) getpid(), (int) time(0), ++ctr, getmyname());
+
+    return(idbuf);
+}
+
+WriteOutMessage(fp, ToList, Subject, CCList, FirstPart)
+FILE *fp;
+char *ToList, *Subject, *CCList;
+struct mailpart *FirstPart;
+{
+    FILE *fpin;
+    static int ctr = 0;
+    fprintf(fp, "MIME-Version: 1.0\n");
+    if (InReplyTo != NULL) {
+        EmitHeader(fp, "In-Reply-To", InReplyTo);
+    }
+    EmitHeaderWithAliases(fp, "To", ToList);
+
+    EmitHeader(fp, "Subject", Subject);
+    if (CCList && *CCList) EmitHeaderWithAliases(fp, "Cc", CCList);
+    if (V_keepblind) {
+        struct passwd *p = getpwuid(getuid());
+        if (!p) {
+            fprintf(stderr, "Can't find your user id to keep a blind copy\n");
+        } else {
+            EmitHeader(fp, "Bcc", p->pw_name);
+        }
+    }
+    fprintf(fp, "Message-ID: %s\n", newid());
+    if (!FirstPart) return; /* empty body */
+    if (FirstPart->next) {
+        char boundary[120];
+        snprintf(boundary, sizeof(boundary), "PART.BOUNDARY.%d.%d.%s.%d.%d",
+                 (int) getuid(), (int) getpid(), getmyname(), (int) time(0), ++ctr);
+        fprintf(fp, "Content-type: multipart/mixed;\n\tboundary=\"%s\"\n\n", boundary);
+        fprintf(fp, "> THIS IS A MESSAGE IN 'MIME' FORMAT.  Your mail reader does not support MIME.\n> Some parts of this will be readable as plain text.\n> To see the rest, you will need to upgrade your mail reader.\n");
+        while(FirstPart) {
+            /* First check to see if it is empty & text, in which case skip it */
+            if (FirstPart->istext) {
+                struct stat stbuf;
+                if (!stat(FirstPart->filename, &stbuf)) {
+                    if (stbuf.st_size == 0) {
+                        FirstPart = FirstPart->next;
+                        continue;
+                    }
+                }
+            }
+            fprintf(fp, "\n--%s\n", boundary);
+            WriteContentTypeAndEncoding(fp, FirstPart);
+            fprintf(fp, "\n");
+            fpin = fopen(FirstPart->filename, "r");
+            if (!fpin) {
+                fprintf(stderr, "Can't read temporary file %s\n", FirstPart->filename);
+                cleanexit(-1);
+            }
+            (void) TranslateInputToEncodedOutput(fpin, fp, FirstPart->encoding_type_needed, FirstPart->content_type);
+            fclose(fpin);
+            FirstPart = FirstPart->next;
+        }
+        fprintf(fp, "\n--%s--\n\n", boundary);
+    } else {
+        WriteContentTypeAndEncoding(fp, FirstPart);
+        fprintf(fp, "\n");
+        fpin = fopen(FirstPart->filename, "r");
+        if (!fpin) {
+            fprintf(stderr, "Can't read temporary file %s\n", FirstPart->filename);
+            cleanexit(-1);
+        }
+        (void) TranslateInputToEncodedOutput(fpin, fp, FirstPart->encoding_type_needed, FirstPart->content_type);
+        fclose(fpin);
+    }
+}
+
+WriteContentTypeAndEncoding(fp, part)
+FILE *fp;
+struct mailpart *part;
+{
+    fprintf(fp, "Content-ID: %s\n", newid());
+    if (part->istext) {
+        if (part->isrich) {
+            if (strcmp(CharacterSet, "us-ascii")
+		 && strcmp(CharacterSet, "koi8-r")
+		 && (strncmp(CharacterSet, "iso-8859-", 9) 
+                      || part->encoding_type_needed != ENC_NONE)) {
+                fprintf(fp, "Content-type: text/richtext; charset=\"%s\"\n", CharacterSet);
+            } else {
+                fprintf(fp, "Content-type: text/richtext\n");
+            }
+        } else {
+            fprintf(fp, "Content-type: ");
+            WriteCtypeNicely(fp, part->content_type);
+            if (strcmp(CharacterSet, "us-ascii")
+                 && (strncmp(CharacterSet, "iso-8859-", 9) 
+                      || part->encoding_type_needed != ENC_NONE)) {
+                fprintf(fp, "; charset=\"%s\"\n", CharacterSet);
+            } else fputs("\n", fp);
+        }
+    } else {
+        fprintf(fp, "Content-type: ");
+        WriteCtypeNicely(fp, part->content_type); /* fixes some syntactic junk */
+        fputs("\n", fp);
+    }
+    if (part->istext && part->isrich && part->encoding_type_needed == ENC_NONE) {
+        /* Don't you believe it... */
+        part->encoding_type_needed = ENC_QP;
+    }
+    if (part->encoding_type_needed == ENC_B64) {
+        fprintf(fp, "Content-Transfer-Encoding: base64\n");
+    } else if (part->encoding_type_needed == ENC_QP) {
+        fprintf(fp, "Content-Transfer-Encoding: quoted-printable\n");
+    }
+}
+
+TranslateInputToEncodedOutput(InputFP, OutputFP, Ecode, ctype)
+FILE *InputFP, *OutputFP;
+int Ecode;
+char *ctype;
+{
+    int c, EightBitSeen = 0;
+
+    switch(Ecode) {
+        case ENC_B64:
+            to64(InputFP, OutputFP, DoesNeedPortableNewlines(ctype));
+            break;
+        case ENC_QP:
+            toqp(InputFP, OutputFP);
+            break;
+        default:
+            while ((c = getc(InputFP)) != EOF){
+                if (c > 127) EightBitSeen = 1;
+                putc(c, OutputFP);
+            }
+    }
+    return(EightBitSeen);
+}
+
+#define	MAX_STACK_SIZE	500
+static int StackSize=0;
+static char *Stack[MAX_STACK_SIZE];
+static char *EnvStartStack[MAX_STACK_SIZE];
+
+/* The following two routines are used when richtext styles need to be 
+   kept open across an inserted object -- i.e. the richtext is split into 
+   two parts of a multipart message */
+
+TempCloseStyles(fp)
+FILE *fp;
+{
+    int i = StackSize;
+    while(--i>=0) {
+        fprintf(fp, "</%s>", Stack[i]);
+    }
+    tfputs(StopUnderline);
+    tfputs(standendbuf);
+    tfputs(BoldOff);
+    fflush(stdout);
+}
+
+RestoreCurrentStyles() {
+    int i=0;
+    while (i<StackSize) {
+        if (EnvStartStack[i]) {
+            tfputs(EnvStartStack[i]);
+        }
+        ++i;
+    }
+}
+
+ReopenStyles(fp, part)
+FILE *fp;
+struct mailpart *part;
+{
+    int i=0;
+    RestoreCurrentStyles();
+    if (StackSize > 0) part->isrich = 1;
+    while (i < StackSize) {
+        fprintf(fp, "<%s>", Stack[i++]);
+    }
+}
+
+richtextreset()
+{
+    StackSize = 0;
+}
+
+AlreadyInStyle(s)
+char *s;
+{
+    int i;
+    for (i=0; i<StackSize; ++i) {
+        if (!strcmp(Stack[i], s)) return(1);
+    }
+    return(0);
+}
+
+StartStyle(fp, s, envstartstr)
+FILE *fp;
+char *s;
+char *envstartstr;
+{
+    char *t;
+    fprintf(fp, "<%s>", s);
+    PartEndsWithNewline=0;
+    t = malloc(1+strlen(s));
+    if (!t) nomemabort();
+    strcpy(t, s);
+    EnvStartStack[StackSize] = envstartstr;
+    Stack[StackSize++] = t;
+    if (!V_quiet) printf("Beginning: %s\n", t);
+}
+
+EndStyle(fp, s)
+FILE *fp;
+char *s;
+{
+    int i = StackSize, j;
+    while(--i>=0) {
+        fprintf(fp, "</%s>", Stack[i]);
+        if (!strcmp(s, Stack[i])) break;
+    }
+    if (i>=0) {
+        free(Stack[i]);
+        --StackSize;
+        for (j=i; j<StackSize; ++j) {
+            Stack[j] = Stack[j+1];
+            EnvStartStack[j] = EnvStartStack[j+1];
+        }
+    } else i=0;
+    while (i<StackSize) {
+        fprintf(fp, "<%s>", Stack[i++]);
+    }
+    PartEndsWithNewline=0;
+    if (!V_quiet) printf("Ending: %s\n", s);
+}
+
+ToggleStyle(name, fp, part, turnonstr, turnoffstr)
+char *name;
+FILE *fp;
+struct mailpart *part;
+char *turnonstr, *turnoffstr;
+{
+    part->isrich = 1;
+    if (AlreadyInStyle(name)) {
+        EndStyle(fp, name);
+        if (turnoffstr) tfputs(turnoffstr);
+        RestoreCurrentStyles(); /* because on some terminals,
+                                  the same thing turns
+                                  off underlining AND bold */
+    } else {
+        StartStyle(fp, name, turnonstr);
+        if (turnonstr) tfputs(turnonstr);
+    }
+}
+
+TryOpeningStyle(name, fp, part, envstartstr)
+char *name;
+FILE *fp;
+struct mailpart *part;
+char *envstartstr;
+{
+    if (AlreadyInStyle(name)) {
+        printf("mailto: Already in %s style\n", name);
+    } else {
+        part->isrich = 1;
+        StartStyle(fp, name, envstartstr);
+    }
+}
+
+TryClosingStyle(name, fp, part)
+char *name;
+FILE *fp;
+struct mailpart *part;
+{
+    if (AlreadyInStyle(name)) {
+        part->isrich = 1;
+        EndStyle(fp, name);
+    } else {
+        printf("mailto: You aren't in a %s style\n", name);
+    }
+}
+
+FputsQuotingLT(s, fp, part, EightBitMode, RightToLeftMode)
+char *s;
+FILE *fp;
+struct mailpart *part;
+int EightBitMode, RightToLeftMode;
+{
+    static int InNewLineSequence=1;
+    int c=0;
+    char LBuf[1000], *sdum;
+    if (*s == '\n') {
+        if (InNewLineSequence) {
+            fputs("<nl>\n", fp);
+        } else {
+            fputs("<nl><nl>\n\n", fp);
+            InNewLineSequence = 1;
+        }
+        part->isrich = 1;
+        PartEndsWithNewline=1;
+        return;
+    }
+    InNewLineSequence = 0;
+    if (RightToLeftMode) {
+        sdum = s+strlen(s)-1;
+        if (*sdum == '\n') --sdum;
+        while (sdum >= s) {
+            LBuf[c++] = *sdum--;
+        }
+        LBuf[c++] = '\n';
+        LBuf[c] = '\0';
+        s = LBuf;
+    }
+    if (isspace((unsigned char) *s)) {
+        /* Lines that start with spaces should not be folded! */
+        fputs("<nl>", fp);
+        part->isrich = 1;
+    }
+    if (s) {
+        if (EightBitMode) part->encoding_type_needed = ENC_QP;
+        while (*s) {
+            c = (unsigned char) *s;
+            if (EightBitMode) {
+                if (isprint(c) && ! isspace(c)) {
+                    c = c+128;
+                }
+                putc(c, fp);
+                putc(c, stdout);
+            } else if (c == '<') {
+                part->isrich = 1;
+                fputs("<lt>", fp);
+            } else {
+                if (c > 127 || c < 0) {
+                    part->encoding_type_needed = ENC_QP;
+                    if (!strcmp(CharacterSet, "us-ascii")) {
+                        SwitchToEuropean();
+                    }
+                }
+                putc(c, fp);
+                if (RightToLeftMode) putc(c, stdout);
+            }
+            ++s;
+        }
+        PartEndsWithNewline = (c == '\n') ? 1 : 0;
+    }
+}
+
+cleanexit(code)
+int code;
+{
+    finalize();
+    exit(code);
+}
+
+finalize() {
+    while (FirstPart) {
+        unlink(FirstPart->filename);
+        FirstPart = FirstPart->next;
+    }
+    FinalizeTerminal();
+}
+
+void
+cleanup(signum)
+int signum;
+{
+    if (fpout) {
+        TempCloseStyles(fpout);
+        fclose(fpout);
+    }
+    if (signum == SIGPIPE) {
+        (void) WriteDeadLetter();
+    }
+    if (signum == SIGINT) {
+        if (V_ignore) {
+            printf("Interrupt ignored because 'ignore' is set.  Use ~q if you want to quit.\n");
+            return;
+        } else {
+            (void) WriteDeadLetter();
+        }
+    }
+    finalize();
+    signal(signum, SIG_DFL);
+    kill(getpid(), signum);
+}
+
+InitSignals() {
+    signal(SIGINT, cleanup);
+    signal(SIGPIPE, cleanup);
+    signal(SIGILL, cleanup);
+    signal(SIGTRAP, cleanup);
+    signal(SIGIOT, cleanup);
+    signal(SIGFPE, cleanup);
+    signal(SIGSEGV, cleanup);
+    signal(SIGTERM, cleanup);
+#ifdef SIGXCPU
+    signal(SIGXCPU, cleanup);
+#endif
+}
+
+WriteDeadLetter()
+{
+    FILE *fp;
+    char DeadFile[1000];
+
+    snprintf(DeadFile, sizeof(DeadFile), "%s/dead.letter", gethome());
+    fp = fopen(DeadFile, "w");
+    WriteOutMessage(fp, ToList, Subject, CCList, FirstPart);
+    if(fclose(fp)) {
+        perror("Could not write ~/dead.letter\n");
+        return(-1);
+    } else {
+        printf("Wrote draft to ~/dead.letter\n");
+        return(0);
+    }
+}
+
+struct MailcapEntry {
+    char *contenttype;
+    char *command;
+    char *testcommand;
+    char *editcommand;
+    char *composecommand;
+    char *composetypedcommand;
+    char *label;
+    int needsterminal;
+    int copiousoutput;
+    struct MailcapEntry *next;
+} *FirstMailcapEntry = NULL;
+
+/* There are a fair number of core leaks in what follows.  That should matter little -- the mailcap files are only parsed once, and are usually pretty small anyway. */
+
+char *
+GetCommand(s, t)
+char *s, **t;
+{
+    char *s2;
+    int quoted = 0;
+    s2 = malloc(strlen(s)*2); /* absolute max, if all % signs */
+    if (!s2) nomemabort();
+    *t = s2;
+    while (s && *s) {
+	if (quoted) {
+            if (*s == '%') *s2++ = '%'; /* Quote through next level, ugh! */
+
+            *s2++ = *s++;
+	    quoted = 0;
+	} else {
+	    if (*s == ';') {
+                *s2 = '\0';
+		return(++s);
+	    }
+	    if (*s == '\\') {
+		quoted = 1;
+		++s;
+	    } else {
+		*s2++ = *s++;
+	    }
+	}
+    }
+    *s2 = '\0';
+    return(NULL);
+}	
+
+char *Cleanse(s, dolc) /* no leading or trailing space, all lower case */
+char *s;
+int dolc;
+{
+    char *tmp, *news;
+    
+    /* strip leading white space */
+    while (*s && isspace((unsigned char) *s)) ++s;
+    news = s;
+    /* put in lower case, find end */
+    for (tmp=s; *tmp; ++tmp) {
+        if (dolc && isupper((unsigned char) *tmp)) *tmp = tolower((unsigned char) *tmp);
+    }
+    /* strip trailing white space */
+    while (--tmp && *tmp && isspace((unsigned char) *tmp)) *tmp = '\0';
+    return(news);
+}
+
+char *DeQuote(s)
+char *s;
+{
+    char *retval;
+    s = Cleanse(s, 0);
+    if (*s != '"') return(s);
+    retval = ++s;
+    while (s && *s) {
+        s = index(s, '\"');
+        if (!s) return(retval); /* but it's a bad parse */
+        if (*(s-1) != '\\') {
+            *s = '\0';
+            return(retval);
+        }
+        ++s;
+    }
+    return(retval); /* also a bad parse */
+}    
+
+struct MailcapEntry *
+GetMailcapEntry(fp)
+FILE *fp;
+{
+    int rawentryalloc = MAX_LINELENGTH, len;
+    char *rawentry, *s, *t, *LineBuf;
+    struct MailcapEntry *mc;
+
+    LineBuf = malloc(MAX_LINELENGTH);
+    if (!LineBuf) nomemabort();
+    rawentry = malloc(1 + rawentryalloc);
+    mc = (struct MailcapEntry *) malloc(sizeof (struct MailcapEntry));
+    if (!rawentry || !mc) nomemabort();
+    *rawentry = '\0';
+    while (fgets(LineBuf, MAX_LINELENGTH, fp)) {
+	if (LineBuf[0] == '#') continue;
+	len = strlen(LineBuf);
+        if (LineBuf[len-1] == '\n') LineBuf[--len] = '\0';
+	if ((len + strlen(rawentry)) > rawentryalloc) {
+            rawentryalloc += MAX_LINELENGTH;
+	    rawentry = realloc(rawentry, rawentryalloc+1);
+	    if (!rawentry) nomemabort();
+	}
+	if (LineBuf[len-1] == '\\') {
+            LineBuf[len-1] = '\0';
+	    strcat(rawentry, LineBuf);
+	} else {
+	    strcat(rawentry, LineBuf);
+	    break;
+	}
+    }
+    free(LineBuf);
+    for (s=rawentry; *s && isspace((unsigned char) *s); ++s) ;
+    if (!*s) {
+	/* totally blank entry -- quietly ignore */
+	free(rawentry);
+	return(NULL);
+    }
+    s = index(rawentry, ';');
+    if (!s) {
+	fprintf(stderr, "mailto: Ignoring invalid mailcap entry: %s\n", rawentry);
+	free(rawentry);
+	return(NULL);
+    }
+    *s++ = '\0';
+    mc->needsterminal = 0;
+    mc->copiousoutput = 0;
+    mc->testcommand = NULL;
+    mc->composecommand = NULL;
+    mc->composetypedcommand = NULL;
+    mc->editcommand = NULL;
+    mc->label = NULL;
+    mc->contenttype = malloc(1+strlen(rawentry));
+    mc->next = NULL;
+    if (!mc->contenttype) nomemabort();
+    strcpy(mc->contenttype, rawentry);
+    t = GetCommand(s, &mc->command);
+    s = t;
+    while (s) {
+	char *arg, *eq;
+
+        t = GetCommand(s, &arg);
+/*        if (t) *t++ = '\0'; */
+        eq = index(arg, '=');
+        if (eq) *eq++ = '\0';
+        arg = Cleanse(arg, 1);
+	if (!strcmp(arg, "needsterminal")) {
+	    mc->needsterminal = 1;
+	} else if (!strcmp(arg, "copiousoutput")) {
+	    mc->copiousoutput = 1;
+        } else if (eq && !strcmp(arg, "test")) {
+            mc->testcommand = DeQuote(eq);
+        } else if (eq && !strcmp(arg, "edit")) {
+            mc->editcommand = DeQuote(eq);
+        } else if (eq && !strcmp(arg, "compose")) {
+            mc->composecommand = DeQuote(eq);
+        } else if (eq && !strcmp(arg, "composetyped")) {
+            mc->composetypedcommand = DeQuote(eq);
+        } else if (eq && !strcmp(arg, "description")) {
+            mc->label = DeQuote(eq);
+        } else if (eq && !strcmp(arg, "label")) { 
+            mc->label = DeQuote(eq); /* bogus old name for description */
+        } else if (eq && !strcmp(arg, "textualnewlines")) {
+            ExceptionalNewline(mc->contenttype, atoi(eq));
+	} else if (strcmp(arg, "notes")) { /* IGNORE notes field */
+/*	    if (*arg) fprintf(stderr, "mailto: Ignoring invalid mailcap flag: %s\n", arg);  */
+	}
+	s = t;
+    }
+    free(rawentry);
+    return(mc);
+}
+
+ProcessMailcapFiles() 
+{
+    char *s, *path = getenv("MAILCAPS"), *origpath;
+    static char *stdpath = STDPATH;
+    struct MailcapEntry *mc, *CurrentMailcapEntry = NULL;
+    FILE *fp;
+
+    if (!path) {
+        int uid = getuid();
+        struct passwd *p;
+        p = getpwuid(uid);
+        if (p) path = malloc(5+strlen(p->pw_dir) + strlen(stdpath));
+        if (!p || !path) nomemabort();
+        strcpy(path, p->pw_dir);
+        strcat(path, stdpath);
+    } else {
+        char *pathcopy;
+        pathcopy = malloc(1+strlen(path));
+        if (!pathcopy) nomemabort();
+        strcpy(pathcopy, path);
+        path = pathcopy;
+    }
+    origpath = path;
+    while(path) {
+        s = index(path, PATH_SEPARATOR);
+        if (s) *s++ = '\0';
+        fp = fopen(path, "r");
+        while (fp && !feof(fp)) {
+            mc = GetMailcapEntry(fp);
+            if (!mc) continue;
+            if (!FirstMailcapEntry) {
+                FirstMailcapEntry = mc;
+                CurrentMailcapEntry = mc;
+            } else {
+                CurrentMailcapEntry->next = mc;
+                CurrentMailcapEntry = mc;
+            }
+	}
+        if (fp) fclose(fp);
+        path = s;
+    }
+    free(origpath);
+    return(-1);
+}
+
+struct mailpart *
+CreateNewPart() {
+    struct mailpart *mp;
+    struct MailcapEntry *mc = FirstMailcapEntry;
+    int i, ans, resultcode;
+    char LineBuf[100], *CmdBuf;
+
+    mp = NewPart();
+    if (!mp) return(NULL);
+    printf("Please choose which kind of data you wish to insert:\n\n");
+    printf("0: A raw file, possibly binary, of no particular data type.\n");
+    printf("1: Raw data from a file, with you specifying the content-type by hand.\n");
+    i = 1;
+    while (mc) {
+        if (mc->composecommand || mc->composetypedcommand) {
+            ++i;
+            if (mc->label) {
+                printf("%d: %s\n", i, mc->label);
+            } else {
+                printf("%d: data in '%s' format\n", i, mc->contenttype);
+            }
+        }
+        mc = mc->next;
+    }
+    printf("\n\nEnter your choice as a number from 0 to %d: ", i);
+    fflush(stdout);
+    fgets(LineBuf, sizeof(LineBuf), stdin);
+    ans = atoi(LineBuf);
+    if (ans == 0 || ans == 1) {
+        char *sdum, CTLineBuf[100];
+        FILE *fpi, *fpo;
+	printf("\nIf you want to include non-textual data from a file, enter the file name.\nTo include the output of a command, enter \"|\" followed by the command.\nIf you do not want to include anything, just press ENTER (RETURN).\n> ");
+        fflush(stdout);
+        fgets(CTLineBuf, sizeof(CTLineBuf), stdin);
+        sdum = CTLineBuf+strlen(CTLineBuf) -1;
+        while (sdum >= CTLineBuf && isspace((unsigned char) *sdum)) {
+            *sdum = '\0';
+            --sdum;
+        }
+        sdum=CTLineBuf;
+        while (*sdum && isspace((unsigned char) *sdum)) ++sdum;
+        if (! *sdum) {
+            printf("Data insertion cancelled\n");
+            return(NULL);
+        }
+	if (*sdum == '|') {
+	    fpi = popen(sdum+1, "r");
+	} else {
+	    fpi = fopen(sdum, "r");
+	}
+        if (!fpi) {
+            printf("Cannot read %s, data insertion cancelled\n", sdum);
+            return(NULL);
+        }
+        fpo = fdopen(mkstemp(mp->filename), "w");
+        if (!fpo) {
+            printf("Cannot open temporary file, data insertion cancelled\n");
+            return(NULL);
+        }
+        (void) TranslateInputToEncodedOutput(fpi, fpo, ENC_NONE, "");
+	if (*sdum == '|') {
+	    fclose(fpi);
+	} else {
+	    pclose(fpi);
+	}
+        fclose(fpo);
+        mp->istext = 0;
+        if (ans == 1) {
+            while (1) {
+                int ct;
+                printf("\nEnter the MIME Content-type value for the data from file %s\n    (type '?' for a list of locally-valid content-types): ", sdum);
+                fflush(stdout);
+                fgets(LineBuf, sizeof(LineBuf), stdin);
+		LineBuf[strlen(LineBuf)-1]='\0';
+                if (index(LineBuf, '/')) {
+                    char lc[100], *s, AnsBuf[100];
+                    strcpy(lc, LineBuf);
+                    for (s=lc; *s; ++s) {
+                        if (isupper(*s)) *s = tolower(*s);
+                    }
+                    if (!strcmp(lc, "text/plain")) break;
+                    if (!strcmp(lc, "application/octet-stream")) break;
+                    mc=FirstMailcapEntry;
+                    while (mc) {
+                        if (mc->contenttype && index(mc->contenttype, '/') && !index(mc->contenttype, '*') && !lc2strcmp(mc->contenttype, lc)) {
+                            break;
+                        }
+                        mc = mc->next;
+                    }
+                    if (mc) break;
+                    printf("The MIME content-type '%s' is not listed in your local mailcap files,\nand may not be a valid MIME type.  Do you want to use it anyway [no] ? ", LineBuf);
+                    s = fgets(AnsBuf, sizeof(AnsBuf), stdin);
+                    while (s && *s && isspace((unsigned char) *s)) ++s;
+                    if (s && (*s == 'y' || *s == 'Y')) break;
+                    continue;
+                }
+                printf("\nMIME content-type values are type/format pairs, and always include a '/'.\nThe types supported at your site include, but are not limited to:\n\n");
+                mc=FirstMailcapEntry;
+                ct = 0;
+                while (mc) {
+                    if (mc->contenttype && index(mc->contenttype, '/') && !index(mc->contenttype, '*')) {
+                        if (ct++) fputs(", ", stdout);
+                        fputs(mc->contenttype, stdout);
+                    }
+                    mc = mc->next;
+                }
+                fputs("\n\nThe MIME content-type for file inclusion is 'application/octet-stream'.\n", stdout);
+            }
+            mp->content_type = freshcopy(LineBuf);
+        } else mp->content_type=freshcopy("application/octet-stream");
+        mp->encoding_type_needed = WhichEncodingForFile(mp->filename, mp->content_type);
+        printf("Included data in '%s' format\n", mp->content_type);
+	printf("(continue)\n");
+        SetTextFlags(mp);
+        return(mp);
+    } else if (ans<0 || ans > i) {
+        printf("Data insertion cancelled\n");
+        return(NULL);
+    }
+    i=2;
+    mc=FirstMailcapEntry;
+    while (mc) {
+        if (mc->composecommand || mc->composetypedcommand) {
+            if (i == ans) break;
+            ++i;
+        }
+        mc = mc->next;
+    }
+    CmdBuf = malloc(CMDSIZE);
+    if (!CmdBuf) nomemabort();
+    BuildCommand(CmdBuf, mc->composecommand ? mc->composecommand : mc->composetypedcommand, mp->filename);
+    printf("Executing: %s\n", CmdBuf);
+    resultcode = SYSTEM(CmdBuf);
+    if (resultcode) {
+        printf("Command execution failed, nothing included\n");
+        free(CmdBuf);
+        return(NULL);
+    }
+    if (access(mp->filename, R_OK)) {
+        printf("No file was created, nothing included!\n");
+        free(CmdBuf);
+        return(NULL);
+    }
+    mp->istext = 0;
+    if (mc->composecommand) {
+        mp->content_type = mc->contenttype;
+        mp->encoding_type_needed = WhichEncodingForFile(mp->filename, mp->content_type);
+    } else {
+        char c, LineBuf[1000], *colon, *ctypebuf = NULL, *cencbuf = NULL, *s, *newfilename;
+        FILE *fp, *fpout;
+        int inheaders=1, bct=0;
+
+        s = LineBuf;
+        fp = fopen(mp->filename, "r");
+        if (!fp) {
+            fprintf(stderr, "Cannot read file %s, no data included.\n", mp->filename);
+            free(CmdBuf);
+            return(NULL);
+        }
+        while ((c = getc(fp)) != EOF && inheaders) {
+            if (c == '\n') {
+                c = getc(fp);
+                if (c == ' ' || c == '\t') {
+                    *s++ = ' ';
+                } else {
+                    /* actually process the header */
+                    *s = 0;
+                    colon = index(LineBuf, ':');
+                    if (colon) {
+                        *colon++ = 0;
+                        for (s=LineBuf; *s; ++s) {
+                            if (isupper(*s)) *s = tolower(*s);
+                        }
+                        if (!strcmp(LineBuf, "content-transfer-encoding")) {
+                            cencbuf = malloc(1+strlen(colon));
+                            if (!cencbuf) nomemabort();
+                            strcpy(cencbuf, colon);
+                        } else if (!strcmp(LineBuf, "content-type")) {
+                            ctypebuf = malloc(1+strlen(colon));
+                            if (!ctypebuf) nomemabort();
+                            strcpy(ctypebuf, colon);
+                        }
+                    }
+                    if (c == '\n') {
+                        inheaders = 0;
+                        break;
+                    }
+                    ungetc(c, fp);
+                    s = LineBuf; /* start over */
+                }
+            } else {
+                *s++ = c;
+            }
+        }
+        if (!ctypebuf) {
+            fprintf(stderr, "The command (%s) did not return a content-type value, so no data could be included.\n", CmdBuf);
+            free(CmdBuf);
+            return(NULL);
+        }
+        mp->content_type = ctypebuf;
+        if (cencbuf) {
+            while (*cencbuf && isspace(*cencbuf)) ++cencbuf;
+            for (s=cencbuf; *s; ++s) {
+                if (isupper(*s)) *s = tolower(*s);
+            }
+            if (!strncmp(cencbuf, "base64", 6)) {
+                mp->encoding_type_needed = ENC_B64;
+            } else if (!strncmp(cencbuf, "quoted-printable", 16)) {
+                mp->encoding_type_needed = ENC_QP;
+            } else {
+                fprintf(stderr, "The command (%s) returned an unrecognized content-transfer-encoding value, so no data could be included.\n", CmdBuf);
+                free(CmdBuf);
+                return(NULL);
+            }
+        } else {
+            mp->encoding_type_needed = ENC_NONE;
+        }
+        newfilename = tmpname();
+        fpout = fdopen(mkstemp(newfilename), "w");
+        if (!fpout) {
+            fprintf(stderr, "Cannot open file %s for writing, no data included.\n", newfilename);
+            free(CmdBuf);
+            return(NULL);
+        }
+        switch(mp->encoding_type_needed) {
+            case ENC_B64:
+                from64(fp, fpout, NULL, &bct, 0);
+                break;
+            case ENC_QP:
+                fromqp(fp, fpout, NULL, &bct);
+                break;
+            default:
+                while ((c = getc(fp)) != EOF) {
+                    putc(c, fpout);
+                }
+                break;
+        }
+        fclose(fp);
+        fclose(fpout);
+        unlink(mp->filename);
+        mp->filename = newfilename;
+    }
+    SetTextFlags(mp);
+    printf("Included data in '%s' format\n", mc->contenttype);
+    printf("(continue)\n");
+    free(CmdBuf);
+    return(mp);
+}
+
+SetTextFlags(mp)
+struct mailpart *mp;
+{
+    if (!lc2strncmp(mp->content_type, "text/", 5)) {
+        mp->istext = 1;
+        if (!lc2strncmp(mp->content_type, "text/richtext", 13)) {
+            mp->isrich = 1;
+        }
+    }
+}
+
+WhichEncodingForFile(fname, ctype)
+char *fname, *ctype;
+{
+    int c, linesize=0, total=0, unsafechars=0, longlines=0;
+    char *s;
+    FILE *fp = fopen(fname, "r");
+    if (!fp) {
+        /* If the stupid editing program forks, this actually will do a 
+              reasonable thing as long as it saves the file before the mail is sent */
+        return(ENC_B64); /* safest */
+    }
+    while ((c = getc(fp)) != EOF) {
+        if (c>127) ++unsafechars;
+        ++total;
+        if (c == '\n') {
+            if (linesize > 79) ++longlines;
+            linesize = 0;
+        } else ++linesize;
+        if (total>1000 && (longlines || unsafechars)) break;
+    }
+    fclose(fp);
+    if (longlines || unsafechars) {
+        for (s=ctype; *s; ++s) if (isupper((unsigned char) *s)) *s = tolower((unsigned char) *s);
+        if (!strncmp(ctype, "image/", 6)
+             || !strncmp(ctype, "audio/", 6)
+             || !strncmp(ctype, "application/octet-stream", 24)
+             || !strncmp(ctype, "video/", 6)) {
+            return(ENC_B64);
+        }
+        if (!unsafechars) return(ENC_QP);
+
+        return((total/unsafechars < 16) ? ENC_B64 : ENC_QP);
+    }
+    return(ENC_NONE);
+}
+
+BuildCommand(Buf, controlstring, TmpFileName)
+char *Buf, *controlstring, *TmpFileName;
+{
+    char *from, *to;
+    int prefixed = 0;
+    int NamedFile=0;
+
+    for (from=controlstring, to=Buf; *from; ++from) {
+        if (prefixed) {
+            prefixed = 0;
+            switch(*from) {
+                case '%':
+                    *to++ = '%';
+                    break;
+                case 's':
+                    if (TmpFileName) {
+                        strcpy(to, TmpFileName);
+                        to += strlen(TmpFileName);
+                        ++NamedFile;
+                    }
+                    break;
+                default:
+                    fprintf(stderr, "Ignoring unrecognized format code in mailcap file: %%<%c\n", *from);
+                    break;
+            }
+        } else if (*from == '%') {
+            prefixed = 1;
+        } else {
+            *to++ = *from;
+        }
+    }
+    *to = '\0';
+    if (!NamedFile) {
+        strcat(Buf, " > ");
+        strcat(Buf, TmpFileName);
+    }
+}
+
+CtypeMatch(ctype, pat)
+char *ctype, *pat;
+{
+    int len;
+    char *s;
+    for (s=ctype; *s; ++s) if (isupper((unsigned char) *s)) *s = tolower((unsigned char) *s);
+    for (s=pat; *s; ++s) if (isupper((unsigned char) *s)) *s = tolower((unsigned char) *s);
+    if (!strcmp(ctype, pat)) {
+        return(1); /* exact match, case-insensitive */
+    }
+    len = strlen(pat);
+    if ((pat[--len] == '*')
+         && (pat[--len] == '/')
+         && (!strncmp(ctype, pat, len))
+         && (ctype[len] == '/')){
+        /* wildcard match */
+        return(1);
+    }
+    return(0);
+}
+
+EditCurrentMessage(UseVisual)
+int UseVisual;
+{
+    char *editor = NULL;
+    char *CmdBuf, *CmdBuf2, LineBuf[100];
+    struct mailpart *mp, *lastmp=NULL;
+    struct MailcapEntry *mc;
+    int partct=1, ans;
+
+    CmdBuf = malloc(CMDSIZE);
+    CmdBuf2 = malloc(CMDSIZE);
+    if (!CmdBuf || !CmdBuf2) nomemabort();
+    if (!PartEndsWithNewline) {
+        putc('\n', fpout);
+        PartEndsWithNewline=1;
+    }
+    fclose(fpout);
+    if (UseVisual) editor = getenv("VISUAL");
+    if (!editor) editor = getenv("EDITOR");
+    if (!editor) editor = DEFAULT_EDITOR;
+    if (!FirstPart->next) {
+        /* Only one part */
+        snprintf(CmdBuf, sizeof(CmdBuf), "%s %s", editor, FirstPart->filename);
+        printf("Executing: %s\n", CmdBuf);
+        SYSTEM(CmdBuf);
+        if ((FirstPart->istext || FirstPart->isrich) &&
+             FirstPart->encoding_type_needed == ENC_NONE &&
+             ContainsEightBitChar(FirstPart->filename)) {
+            FirstPart->encoding_type_needed = ENC_QP;
+        }
+        fpout = fopen(FirstPart->filename, "a");
+        free(CmdBuf);
+        free(CmdBuf2);
+        return;
+    }
+    lastmp = mp = FirstPart;
+    while (mp) {
+        printf("Part #%d is of type '%s'.\n", partct, mp->content_type);
+        snprintf(CmdBuf, sizeof(CmdBuf), "%s %s", editor, mp->filename);
+        if (mp->mc && mp->mc->editcommand) {
+            BuildCommand(CmdBuf2, mp->mc->editcommand, mp->filename);
+        } else {
+            mc = FirstMailcapEntry;
+            while (mc) {
+                if (mc->editcommand && CtypeMatch(mp->content_type, mc->contenttype)) {
+                    break;
+                }
+                mc = mc->next;
+            }
+            if (mc) {
+                BuildCommand(CmdBuf2, mc->editcommand, mp->filename);
+            } else {
+                CmdBuf2[0] = '\0';
+            }
+        }
+        if (CmdBuf2[0]) {
+            printf("Which command do you want to use to edit it?\n\n");
+            printf("1: %s\n", CmdBuf2);
+            printf("2: %s\n", CmdBuf);
+            printf("\n\nEnter 1 or 2, or 0 to not edit it: ");
+            fflush(stdout);
+            fgets(LineBuf, sizeof(LineBuf), stdin);
+            ans = atoi(LineBuf);
+        } else ans = 2;
+        if (ans == 1) {
+            printf("Executing: %s\n", CmdBuf2);
+            SYSTEM(CmdBuf2);
+        } else if (ans == 2) {
+            printf("Executing: %s\n", CmdBuf);
+            SYSTEM(CmdBuf);
+        }
+        if ((mp->istext || mp->isrich) &&
+             mp->encoding_type_needed == ENC_NONE &&
+             ContainsEightBitChar(mp->filename)) {
+            mp->encoding_type_needed = ENC_QP;
+        }
+        ++partct;
+        lastmp = mp;
+        mp = mp->next;
+    }
+    fpout = fopen(lastmp->filename, "a");
+    free(CmdBuf);
+    free(CmdBuf2);
+}
+
+
+ProcessInitFiles() {
+    char fname[FILE_NAME_SIZE];
+
+    ProcessOneMailRC("/usr/lib/Mail.rc", 0);
+    snprintf(fname, sizeof(fname), "%s/.mailrc", gethome());
+    ProcessOneMailRC(fname, 0);
+    snprintf(fname, sizeof(fname), "%s/.AMS_aliases", gethome());
+    ProcessOneMailRC(fname, 1);
+}
+
+char *
+NextAliasLine(LineBuf, LineAlloced, LineCount, fp, IsAndrew)
+char *LineBuf;
+int *LineAlloced, *LineCount;
+FILE *fp;
+int IsAndrew;
+{
+    char *sbuf;
+    sbuf = malloc(MAX_LINELENGTH);
+    if (!sbuf) nomemabort();
+    if (!LineBuf) {
+        *LineAlloced = MAX_LINELENGTH + MAX_LINELENGTH;
+        LineBuf = malloc(*LineAlloced);
+        if (!LineBuf) nomemabort();
+    }
+    *LineBuf = 0;
+    *LineCount = 0;
+    while (1) {
+        if (fgets(sbuf, MAX_LINELENGTH, fp) == NULL) {
+            return(LineBuf);
+        }
+        *LineCount += strlen(sbuf);
+        if (*LineCount >= *LineAlloced) {
+            *LineAlloced += MAX_LINELENGTH;
+            LineBuf = realloc(LineBuf, *LineAlloced);
+            if (!LineBuf) nomemabort();
+        }
+        strcat(LineBuf, sbuf);
+        if (IsAndrew || LineBuf[*LineCount - 2] != '\\') return(LineBuf);
+        /* The -2 got us past the newline. */
+        LineBuf[*LineCount - 2] = ' ';
+        *LineCount -= 1;
+        LineBuf[*LineCount] = '\0';
+    }
+}
+
+ProcessOneMailRC(fname, IsAndrew)
+char *fname;
+int IsAndrew;
+{
+    FILE *fp;
+    char *LineBuf = NULL, *sdum;
+    int LineAlloced = 0, LineCount = 0;
+
+    fp = fopen(fname, "r");
+    if (!fp) return;
+    do {
+        LineBuf=NextAliasLine(LineBuf, &LineAlloced, &LineCount, fp, IsAndrew);
+        if (LineCount == 0) continue;
+        if (IsAndrew && LineBuf[0] == '#') continue;
+        for (sdum = LineBuf; *sdum; ++sdum) {
+            if (*sdum == ' ') break; /* only map first word to lower case */
+            if (isupper((unsigned char) *sdum)) *sdum = tolower((unsigned char) *sdum);
+        }
+        if (IsAndrew) {
+            HandleAliasCommand(LineBuf);
+        } else if (!strncmp(LineBuf, "set ", 4)) {
+            HandleSetCommand(LineBuf+4, 1);
+        } else if (!strncmp(LineBuf, "unset ", 6)) {
+            HandleSetCommand(LineBuf+6, 0);
+        } else if (!strncmp(LineBuf, "alias ", 6)) {
+            HandleAliasCommand(LineBuf+6);
+        } else {
+            /* ignore */
+        }
+    } while (LineCount != 0);
+    free(LineBuf);
+    fclose(fp);
+}
+
+HandleSetCommand(cmd, DoSet)
+char *cmd;
+int DoSet;
+{
+    char *s;
+    int i;
+
+    while (*cmd) {
+        while (*cmd && isspace((unsigned char) *cmd)) ++cmd;
+        for (s=cmd; *s && !isspace((unsigned char) *s); ++s) {;}
+        *s++ = '\0';
+        if (!strcmp(cmd, "askcc")) {
+            V_askcc = DoSet;
+        } else if (!strcmp(cmd, "dot")) {
+            V_dot = DoSet;
+        } else if (!strcmp(cmd, "ignore")) {
+            V_ignore = DoSet;
+        } else if (!strcmp(cmd, "verbose")) {
+            V_verbose = DoSet;
+        } else if (!strcmp(cmd, "quiet")) {
+            V_quiet = DoSet;
+        } else if (!strcmp(cmd, "keepblind")) {
+            V_keepblind = DoSet;
+        } else if (!strcmp(cmd, "commasonly")) {
+            V_commasonly = DoSet;
+        } else if (!strncmp(cmd, "splitsize ", 9)) {
+            i = atoi(cmd+10);
+            if (i < MINCHUNKSIZE) {
+                fprintf(stderr, "Ignoring splitsize mailrc setting of %d -- the minimum value is %d\n", i, MINCHUNKSIZE);
+            } else {
+                SplitSize = i;
+            }
+        } else {
+            /* ignore */
+        }
+        cmd = s;;
+    }
+}
+
+struct alias {
+    char *shortname, *longname;
+    struct alias *next;
+} *FirstAlias = NULL;
+
+HandleAliasCommand(aliasline)
+char *aliasline;
+{
+    struct alias *tmpalias;
+    char *s, *s2;
+    int len = strlen(aliasline);
+
+    if (aliasline[len - 1] == '\n') {
+        aliasline[len - 1] = '\0';
+    }
+    tmpalias = (struct alias *) malloc(sizeof (struct alias));
+    s = malloc(len + 1);
+    if (!s || !tmpalias) nomemabort();
+    strcpy(s, aliasline);
+    while (*s && isspace((unsigned char) *s)) { ++s;}
+    for (s2=s; *s2 && !isspace((unsigned char) *s2); ++s2) {;}
+    if (!*s2) {
+        if (s != s2) printf("mailto: ignoring bad alias line in init file: %s\n", aliasline);
+        free(s);
+        free(tmpalias);
+        return;
+    }
+    *s2++ = '\0';
+    tmpalias->shortname = s;
+    tmpalias->longname = s2;
+    tmpalias->next = FirstAlias;
+    FirstAlias = tmpalias;
+}
+
+EmitHeader(fp, hdr, body)
+FILE *fp;
+char *hdr;
+char *body;
+{
+    fputs(hdr, fp);
+    fputs(": ", fp);
+    HeaderFputs(body, fp, hdr);
+    fputs("\n", fp);
+/*    fprintf(fp, "%s: %s\n", hdr, body ? body : ""); */
+}
+
+char *
+firstbad(s)
+char *s;
+{
+    char *dum;
+    for (dum=s; *dum; ++dum) {
+        if (!isascii(*dum) || iscntrl(*dum)) {
+            return(dum);
+        }
+    }
+    return(NULL);
+}
+
+char *
+firstgood(s)
+char *s;
+{
+    char *dum;
+    for (dum=s; *dum; ++dum) {
+        if (isascii(*dum) && !iscntrl(*dum)) {
+            return(dum);
+        }
+    }
+    return(NULL);
+}
+
+HeaderFputs(s, fp, hdr)
+char *s;
+FILE *fp;
+char *hdr;
+{
+    char *firstnonascii, *firstascii;
+
+    if (!s) return;
+    firstnonascii=firstbad(s);
+    if (firstnonascii) {
+        if (!strcmp(CharacterSet, "us-ascii")) {
+            fprintf(stderr, "Warning:  The prevailing character set is ASCII.  Your %s header has\nnon-ASCII or non-printing ASCII characters which may be unreadable.\n", hdr);
+        }
+        while (firstnonascii) {
+            while (s < firstnonascii) {
+                putc(*s, fp);
+                ++s;
+            }
+            firstascii=firstgood(s);
+            if (!firstascii) firstascii = s+strlen(s);
+            if ((firstascii - s) > 25) firstascii = s+25; /* Short encoded words */
+            /* general format is =?charset?B or Q?encoded data?= */
+            fprintf(fp, "=?%s?Q?", CharacterSet);
+            while (s < firstascii) {
+                PutQP(*s, fp);
+                ++s;
+            }
+            fputs("?= ", fp); /* close encoded word */
+            firstnonascii=firstbad(s);
+        }
+        while (*s) {
+            putc(*s, fp);
+            ++s;
+        }
+    } else {
+        fputs(s, fp);
+    }
+}
+
+static char basis_hex[] = "0123456789ABCDEF";
+
+PutQP(c, fp)
+unsigned char c;
+FILE *fp;
+{
+    putc('=', fp);
+    putc(basis_hex[c>>4], fp);
+    putc(basis_hex[c&0xF], fp);
+}
+
+EmitHeaderWithAliases(fp, hdr, names)
+FILE *fp;
+char *hdr;
+char *names;
+{
+    fputs(hdr, fp);
+    fputs(": ", fp);
+    EmitAddresses(fp, names, hdr);
+    fputs("\n", fp);
+}
+
+EmitAddresses(fp, names, hdr)
+FILE *fp;
+char *names;
+char *hdr;
+{
+    char *s;
+    while (names) {
+        s= index(names, ',');
+        if (s) *s = '\0';
+        DeAlias(names, fp, hdr);
+        if (s) {
+            *s++ = ',';
+            fputs(",\n\t", fp);
+        }
+        names = s;
+    }
+}
+
+DeAlias(name, fp, hdr)
+char *name;
+FILE *fp;
+char *hdr;
+{
+    struct alias *tmpalias;
+    char *end, savechar;
+
+    while (isspace((unsigned char) *name)) ++name;
+    end = name+strlen(name)-1;
+    while (isspace((unsigned char) *end)) --end;
+    ++end;
+    savechar = *end;
+    for (tmpalias=FirstAlias; tmpalias; tmpalias = tmpalias->next) {
+        if (!strcmp(tmpalias->shortname, name)) { 
+/*        if (!lc2strcmp(name, tmpalias->shortname)) { */
+            *end = savechar;
+            EmitAddresses(fp, tmpalias->longname, hdr);
+            return;
+        }
+    }
+    *end = savechar;
+    HeaderFputs(name, fp, hdr);
+}
+
+
+WriteCtypeNicely(fp, ct)
+FILE *fp;
+char *ct;
+{
+    char *semi, *slash, *eq, *s;
+
+    for (s = ct; *s; ++s) {
+        if (*s == '\n') *s = ' ';
+    }
+    semi = (char *) index(ct, ';');
+    if (semi) *semi = '\0';
+    slash = (char *) index(ct, '/');
+    fputs(ct, fp);
+    if (!slash) fputs("/unknown", fp);
+    while (semi) {
+        ct = semi + 1;
+        *semi = ';';
+        semi = (char *) index(ct, ';');
+        if (semi) *semi = '\0';
+        eq = (char *) index(ct, '=');
+        if (eq) *eq = '\0';
+        fputs(";\n\t", fp);
+        while (isspace((unsigned char) *ct)) ++ct;
+        fputs(ct, fp);
+        if (eq) {
+            s = eq;
+            fputs("=", fp);
+            ++s;
+            while (isspace((unsigned char) *s)) ++s;
+            fputsquoting(s, fp);
+            *eq = '=';
+        }
+    }
+}
+
+fputsquoting(s, fp)
+char *s;
+FILE *fp;
+{
+    char *end = s + strlen(s) - 1;
+    while (isspace((unsigned char) *end) && end > s) --end;
+    if (*s == '\"') {
+        putc(*s, fp);
+        while (*++s) {
+            if (*s == '\"') break; /* MAY TERMINATE EARLY! */
+            if (*s == '\\') {
+                putc(*s, fp);
+                ++s; /* Don't check this next char */
+                if (!*s) break;
+            }
+            putc(*s, fp);
+        }
+        putc('\"', fp);
+    } else {
+        putc('\"', fp);
+        putc(*s, fp);
+        while (*++s) {
+            if (*s == '\"' || *s == '\\') {
+                putc('\\', fp);
+            }
+            putc(*s, fp);
+        }
+        putc('\"', fp);
+    }
+}
+        
+        
+controlputc(c)
+char c;
+{
+    fputc(c, stdout);
+}
+
+/* Do the equivalent of an fputs for the terminal escape stuff */
+
+tfputs(s)
+char *s;
+{
+    tputs(s, 1, controlputc);
+}
+
+ContainsEightBitChar(fname)
+char *fname;
+{
+    int c, eightBitSeen = 0;
+    FILE *fp = fopen(fname, "r");
+    if (!fp) {
+        /* If the stupid editing program forks, this actually will do a
+              reasonable thing as long as it saves the file before the mail is sent */
+        return(1); /* safest */
+    }
+    while ((c = getc(fp)) != EOF) {
+        if (c>127) {
+            eightBitSeen = 1;
+            break;
+        }
+    }
+    fclose(fp);
+    return(eightBitSeen);
+}
+
+SwitchToEuropean() {
+    printf("WARNING:  You have entered 8-bit characters in what is supposed to be\n");
+    printf("plain ASCII text.  If you are using a non-ASCII character set, you should\n");
+    printf("declare this to be the case with the MM_CHARSET environment variable.\n");
+    printf("For now, I am assuming you are using the iso-8859-1 character set,\n");
+    printf("but this may be false.\n");
+    CharacterSet = malloc(12);
+    if (!CharacterSet) nomemabort();
+    strcpy(CharacterSet, "iso-8859-1");
+}
+
+    
--- metamail-2.7.orig/src/metamail/Makefile.am
+++ metamail-2.7/src/metamail/Makefile.am
@@ -0,0 +1,21 @@
+MAINTAINERCLEANFILES    = Makefile.in
+
+CFLAGS			= -lncurses
+
+INCLUDES                = -I$(top_builddir) -I$(top_builddir)/metamail \
+                        -I$(top_srcdir) -I$(top_srcdir)/metamail
+
+bin_PROGRAMS            = metamail mimencode mailto splitmail
+
+metamail_SOURCES	= metamail.c codes.c uue.c shared.c environment.c \
+mailcap.c tmpfile.c
+metamail_LDADD		= $(top_builddir)/metamail/libmetamail.la
+
+mimencode_SOURCES	= mimencode.c codes.c
+mimencode_LDADD		= $(top_builddir)/metamail/libmetamail.la
+
+mailto_SOURCES		= mailto.c codes.c shared.c
+mailto_LDADD		= $(top_builddir)/metamail/libmetamail.la
+
+splitmail_SOURCES	= splitmail.c shared.c
+splitmail_LDADD		= $(top_builddir)/metamail/libmetamail.la
--- metamail-2.7.orig/src/metamail/Makefile.in
+++ metamail-2.7/src/metamail/Makefile.in
@@ -0,0 +1,399 @@
+# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AS = @AS@
+CATCOMMAND = @CATCOMMAND@
+CC = @CC@
+DLLTOOL = @DLLTOOL@
+ECHO = @ECHO@
+EXEEXT = @EXEEXT@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LN_S = @LN_S@
+LPRCOMMAND = @LPRCOMMAND@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_aux_dir = @ac_aux_dir@
+
+MAINTAINERCLEANFILES = Makefile.in
+
+CFLAGS = -lncurses
+
+INCLUDES = -I$(top_builddir) -I$(top_builddir)/metamail                         -I$(top_srcdir) -I$(top_srcdir)/metamail
+
+
+bin_PROGRAMS = metamail mimencode mailto splitmail
+
+metamail_SOURCES = metamail.c codes.c uue.c shared.c environment.c mailcap.c tmpfile.c
+
+metamail_LDADD = $(top_builddir)/metamail/libmetamail.la
+
+mimencode_SOURCES = mimencode.c codes.c
+mimencode_LDADD = $(top_builddir)/metamail/libmetamail.la
+
+mailto_SOURCES = mailto.c codes.c shared.c
+mailto_LDADD = $(top_builddir)/metamail/libmetamail.la
+
+splitmail_SOURCES = splitmail.c shared.c
+splitmail_LDADD = $(top_builddir)/metamail/libmetamail.la
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = ../../metamail/config.h
+CONFIG_CLEAN_FILES = 
+bin_PROGRAMS =  metamail$(EXEEXT) mimencode$(EXEEXT) mailto$(EXEEXT) \
+splitmail$(EXEEXT)
+PROGRAMS =  $(bin_PROGRAMS)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir) -I../../metamail
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+metamail_OBJECTS =  metamail.$(OBJEXT) codes.$(OBJEXT) uue.$(OBJEXT) \
+shared.$(OBJEXT) environment.$(OBJEXT) mailcap.$(OBJEXT) \
+tmpfile.$(OBJEXT)
+metamail_DEPENDENCIES =  $(top_builddir)/metamail/libmetamail.la
+metamail_LDFLAGS = 
+mimencode_OBJECTS =  mimencode.$(OBJEXT) codes.$(OBJEXT)
+mimencode_DEPENDENCIES =  $(top_builddir)/metamail/libmetamail.la
+mimencode_LDFLAGS = 
+mailto_OBJECTS =  mailto.$(OBJEXT) codes.$(OBJEXT) shared.$(OBJEXT)
+mailto_DEPENDENCIES =  $(top_builddir)/metamail/libmetamail.la
+mailto_LDFLAGS = 
+splitmail_OBJECTS =  splitmail.$(OBJEXT) shared.$(OBJEXT)
+splitmail_DEPENDENCIES =  $(top_builddir)/metamail/libmetamail.la
+splitmail_LDFLAGS = 
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+DIST_COMMON =  Makefile.am Makefile.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP_ENV = --best
+DEP_FILES =  .deps/codes.P .deps/environment.P .deps/mailcap.P \
+.deps/mailto.P .deps/metamail.P .deps/mimencode.P .deps/shared.P \
+.deps/splitmail.P .deps/tmpfile.P .deps/uue.P
+SOURCES = $(metamail_SOURCES) $(mimencode_SOURCES) $(mailto_SOURCES) $(splitmail_SOURCES)
+OBJECTS = $(metamail_OBJECTS) $(mimencode_OBJECTS) $(mailto_OBJECTS) $(splitmail_OBJECTS)
+
+all: all-redirect
+.SUFFIXES:
+.SUFFIXES: .S .c .lo .o .obj .s
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
+	cd $(top_srcdir) && $(AUTOMAKE) --foreign src/metamail/Makefile
+
+Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
+	cd $(top_builddir) \
+	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+mostlyclean-binPROGRAMS:
+
+clean-binPROGRAMS:
+	-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
+distclean-binPROGRAMS:
+
+maintainer-clean-binPROGRAMS:
+
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	$(mkinstalldirs) $(DESTDIR)$(bindir)
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    echo " $(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
+	    $(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+	  else :; fi; \
+	done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+	done
+
+# FIXME: We should only use cygpath when building on Windows,
+# and only if it is available.
+.c.obj:
+	$(COMPILE) -c `cygpath -w $<`
+
+.s.o:
+	$(COMPILE) -c $<
+
+.S.o:
+	$(COMPILE) -c $<
+
+mostlyclean-compile:
+	-rm -f *.o core *.core
+	-rm -f *.$(OBJEXT)
+
+clean-compile:
+
+distclean-compile:
+	-rm -f *.tab.c
+
+maintainer-clean-compile:
+
+.s.lo:
+	$(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+.S.lo:
+	$(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+
+maintainer-clean-libtool:
+
+metamail$(EXEEXT): $(metamail_OBJECTS) $(metamail_DEPENDENCIES)
+	@rm -f metamail$(EXEEXT)
+	$(LINK) $(metamail_LDFLAGS) $(metamail_OBJECTS) $(metamail_LDADD) $(LIBS)
+
+mimencode$(EXEEXT): $(mimencode_OBJECTS) $(mimencode_DEPENDENCIES)
+	@rm -f mimencode$(EXEEXT)
+	$(LINK) $(mimencode_LDFLAGS) $(mimencode_OBJECTS) $(mimencode_LDADD) $(LIBS)
+
+mailto$(EXEEXT): $(mailto_OBJECTS) $(mailto_DEPENDENCIES)
+	@rm -f mailto$(EXEEXT)
+	$(LINK) $(mailto_LDFLAGS) $(mailto_OBJECTS) $(mailto_LDADD) $(LIBS)
+
+splitmail$(EXEEXT): $(splitmail_OBJECTS) $(splitmail_DEPENDENCIES)
+	@rm -f splitmail$(EXEEXT)
+	$(LINK) $(splitmail_LDFLAGS) $(splitmail_OBJECTS) $(splitmail_LDADD) $(LIBS)
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS)'; \
+	unique=`for i in $$list; do echo $$i; done | \
+	  awk '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	here=`pwd` && cd $(srcdir) \
+	  && mkid -f$$here/ID $$unique $(LISP)
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)'; \
+	unique=`for i in $$list; do echo $$i; done | \
+	  awk '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+	  || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags  $$unique $(LISP))
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+	-rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = src/metamail
+
+distdir: $(DISTFILES)
+	here=`cd $(top_builddir) && pwd`; \
+	top_distdir=`cd $(top_distdir) && pwd`; \
+	distdir=`cd $(distdir) && pwd`; \
+	cd $(top_srcdir) \
+	  && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign src/metamail/Makefile
+	@for file in $(DISTFILES); do \
+	  d=$(srcdir); \
+	  if test -d $$d/$$file; then \
+	    cp -pr $$d/$$file $(distdir)/$$file; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+	    || cp -p $$d/$$file $(distdir)/$$file || :; \
+	  fi; \
+	done
+
+DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
+
+-include $(DEP_FILES)
+
+mostlyclean-depend:
+
+clean-depend:
+
+distclean-depend:
+	-rm -rf .deps
+
+maintainer-clean-depend:
+
+%.o: %.c
+	@echo '$(COMPILE) -c $<'; \
+	$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+	@-cp .deps/$(*F).pp .deps/$(*F).P; \
+	tr ' ' '\012' < .deps/$(*F).pp \
+	  | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+	    >> .deps/$(*F).P; \
+	rm .deps/$(*F).pp
+
+%.lo: %.c
+	@echo '$(LTCOMPILE) -c $<'; \
+	$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+	@-sed -e 's/^\([^:]*\)\.o[ 	]*:/\1.lo \1.o :/' \
+	  < .deps/$(*F).pp > .deps/$(*F).P; \
+	tr ' ' '\012' < .deps/$(*F).pp \
+	  | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+	    >> .deps/$(*F).P; \
+	rm -f .deps/$(*F).pp
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am: install-binPROGRAMS
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am: uninstall-binPROGRAMS
+uninstall: uninstall-am
+all-am: Makefile $(PROGRAMS)
+all-redirect: all-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs:
+	$(mkinstalldirs)  $(DESTDIR)$(bindir)
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f Makefile $(CONFIG_CLEAN_FILES)
+	-rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+	-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+mostlyclean-am:  mostlyclean-binPROGRAMS mostlyclean-compile \
+		mostlyclean-libtool mostlyclean-tags mostlyclean-depend \
+		mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am:  clean-binPROGRAMS clean-compile clean-libtool clean-tags \
+		clean-depend clean-generic mostlyclean-am
+
+clean: clean-am
+
+distclean-am:  distclean-binPROGRAMS distclean-compile distclean-libtool \
+		distclean-tags distclean-depend distclean-generic \
+		clean-am
+	-rm -f libtool
+
+distclean: distclean-am
+
+maintainer-clean-am:  maintainer-clean-binPROGRAMS \
+		maintainer-clean-compile maintainer-clean-libtool \
+		maintainer-clean-tags maintainer-clean-depend \
+		maintainer-clean-generic distclean-am
+	@echo "This command is intended for maintainers to use;"
+	@echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-am
+
+.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
+maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
+mostlyclean-compile distclean-compile clean-compile \
+maintainer-clean-compile mostlyclean-libtool distclean-libtool \
+clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags distdir \
+mostlyclean-depend distclean-depend clean-depend \
+maintainer-clean-depend info-am info dvi-am dvi check check-am \
+installcheck-am installcheck install-exec-am install-exec \
+install-data-am install-data install-am install uninstall-am uninstall \
+all-redirect all-am all installdirs mostlyclean-generic \
+distclean-generic clean-generic maintainer-clean-generic clean \
+mostlyclean distclean maintainer-clean
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
--- metamail-2.7.orig/src/metamail/output
+++ metamail-2.7/src/metamail/output
@@ -0,0 +1,428 @@
+PWD=/home/mike/debian/metamail-2.7/src/metamail
+XAUTHORITY=/home/mike/.Xauthority
+WINDOWID=20971534
+MM_SUMMARY=7  (from Stephan Wright <stephan.wright@chello.at> )
+MM_HEADERS=
+From stephan.wright@chello.at Wed Jan 17 00:54:06 2001
+Return-path: <stephan.wright@chello.at>
+Envelope-to: mike@localhost
+Delivery-date: Wed, 17 Jan 2001 00:54:06 +0100
+Received: from localhost ([127.0.0.1] ident=mail)
+	by skair.in.natoka.at with esmtp (Exim 3.20 #1 (Debian))
+	id 14IfvR-0000eJ-00
+	for <mike@localhost>; Wed, 17 Jan 2001 00:54:05 +0100
+Received: from stud3.tuwien.ac.at [193.170.75.13]
+	by localhost with POP3 (fetchmail-5.5.3)
+	for mike@localhost (single-drop); Wed, 17 Jan 2001 00:54:05 +0100 (CET)
+Received: from mr.tuwien.ac.at (mr.tuwien.ac.at [128.130.2.10])
+	by stud3.tuwien.ac.at (8.9.3 (PHNE_18979)/8.9.3) with ESMTP id AAA08182;
+	Wed, 17 Jan 2001 00:39:08 +0100 (MET)
+Received: from viemta06.chello.at (viemta06.chello.at [195.34.133.56])
+	by mr.tuwien.ac.at (8.11.1/8.11.1) with ESMTP id f0GNd4C26837;
+	Wed, 17 Jan 2001 00:39:04 +0100 (MET)
+Received: from michelangelo.telekabel.at ([62.178.9.127])
+          by viemta06.chello.at
+          (InterMail vK.4.03.01.00 201-232-122 license 9caa03a7df1d31c048ffcc0d31ac5855)
+          with ESMTP
+          id <20010116233900.BMRG7188.viemta06@michelangelo.telekabel.at>;
+          Wed, 17 Jan 2001 00:39:00 +0100
+Message-ID: <3A64DBB9.74527B61@chello.at>
+Date: Wed, 17 Jan 2001 00:39:37 +0100
+From: Stephan Wright <stephan.wright@chello.at>
+Reply-To: stephan.wright@chello.at
+X-Mailer: Mozilla 4.01 [de] (Win95; I)
+MIME-Version: 1.0
+To: Wolfgang Hiermann <wolfgang.hiermann@teleweb.at>,
+        Susanne Schuster <e9107982@student.tuwien.ac.at>,
+        Roland Summerauer <h9751337@obelix.wu-wien.ac.at>,
+        Raimund Kirner <e9625030@student.tuwien.ac.at>,
+        "Michael Mörz" <e9625136@student.tuwien.ac.at>,
+        Doris Ulrich <e8101579@student.tuwien.ac.at>,
+        Daniel Wronski <e9625027@student.tuwien.ac.at>,
+        Balazs Lichtl <e9625772@stud3.tuwien.ac.at>
+Subject: [Fwd: Fw: Das ist aber lieb geschrieben!]
+X-Priority: 3 (Normal)
+Content-Type: multipart/mixed; boundary="------------A0D4511CCFC2DF8B814B1B9E"
+X-UIDL: *2+!!Ec8e9F>?!!70^!!
+Status: RO
+Content-Length: 32777
+Lines: 485
+
+MM_NOTTTY=1
+MM_QUIET=cat
+HOSTNAME=skair
+DEBFULLNAME=Michael Moerz
+MM_MAILER=unknown
+GDMSESSION=Gnome
+USER=mike
+MACHTYPE=i386-pc-linux-gnu
+DEBEMAIL=e9625136@stud3.tuwien.ac.at
+MAIL=/var/spool/mail/mike
+LANG=C
+DISPLAY=:0.0
+MM_USEPAGER=0
+LOGNAME=mike
+SHLVL=3
+SSH_AGENT_PID=1306
+SESSION_MANAGER=local/skair:/tmp/.ICE-unix/1263
+MM_CONTENTTYPE=multipart/mixed ; boundary = "------------A0D4511CCFC2DF8B814B1B9E"
+USERNAME=mike
+SHELL=/bin/bash
+HOSTTYPE=i386
+CVSROOT=:pserver:mike@localhost:/home/repositories
+MM_DEBUG=1
+MM_NOASK=text,text/plain,text/richtext
+MM_RUNASROOT=0
+OSTYPE=linux-gnu
+HOME=/home/mike
+TERM=xterm
+SSH_AUTH_SOCK=/tmp/ssh-ApDG1263/agent.1263
+PATH=/home/mike/debian/metamail-2.7/src/metamail/.libs:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
+_=/usr/bin/printenv
+PWD=/home/mike/debian/metamail-2.7/src/metamail
+XAUTHORITY=/home/mike/.Xauthority
+WINDOWID=20971534
+MM_SUMMARY=oding: 8bit  (from Stephan Wright <stephan.wright@chello.at> )
+MM_HEADERS=
+Content-Type: text/plain; charset=iso-8859-1
+Content-Type: text/plain; charset=iso-8859-1
+Content-Transfer-Encoding: 8bit
+Content-Transfer-Encoding: 8bit
+
+MM_NOTTTY=1
+MM_QUIET=cat
+HOSTNAME=skair
+DEBFULLNAME=Michael Moerz
+MM_MAILER=unknown
+GDMSESSION=Gnome
+USER=mike
+MACHTYPE=i386-pc-linux-gnu
+DEBEMAIL=e9625136@stud3.tuwien.ac.at
+MAIL=/var/spool/mail/mike
+LANG=C
+DISPLAY=:0.0
+MM_USEPAGER=0
+LOGNAME=mike
+SHLVL=3
+SSH_AGENT_PID=1306
+SESSION_MANAGER=local/skair:/tmp/.ICE-unix/1263
+MM_CONTENTTYPE=text/plain ; charset = iso-8859-1
+USERNAME=mike
+SHELL=/bin/bash
+HOSTTYPE=i386
+CVSROOT=:pserver:mike@localhost:/home/repositories
+MM_DEBUG=1
+MM_NOASK=text,text/plain,text/richtext
+MM_RUNASROOT=0
+OSTYPE=linux-gnu
+HOME=/home/mike
+TERM=xterm
+SSH_AUTH_SOCK=/tmp/ssh-ApDG1263/agent.1263
+PATH=/home/mike/debian/metamail-2.7/src/metamail/.libs:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
+_=/usr/bin/printenv
+PWD=/home/mike/debian/metamail-2.7/src/metamail
+XAUTHORITY=/home/mike/.Xauthority
+WINDOWID=20971534
+MM_SUMMARY=oding: 8bit  (from Stephan Wright <stephan.wright@chello.at> )
+MM_HEADERS=
+Content-Type: text/plain; charset=iso-8859-1
+Content-Type: text/plain; charset=iso-8859-1
+Content-Transfer-Encoding: 8bit
+Content-Transfer-Encoding: 8bit
+
+MM_NOTTTY=0
+MM_QUIET=cat
+HOSTNAME=skair
+DEBFULLNAME=Michael Moerz
+MM_MAILER=unknown
+GDMSESSION=Gnome
+USER=mike
+MACHTYPE=i386-pc-linux-gnu
+DEBEMAIL=e9625136@stud3.tuwien.ac.at
+MAIL=/var/spool/mail/mike
+LANG=C
+DISPLAY=:0.0
+MM_USEPAGER=0
+LOGNAME=mike
+SHLVL=3
+SSH_AGENT_PID=1306
+SESSION_MANAGER=local/skair:/tmp/.ICE-unix/1263
+MM_CONTENTTYPE=text/plain ; charset = iso-8859-1
+USERNAME=mike
+SHELL=/bin/bash
+HOSTTYPE=i386
+CVSROOT=:pserver:mike@localhost:/home/repositories
+MM_DEBUG=1
+MM_NOASK=text,text/plain,text/richtext
+MM_RUNASROOT=0
+OSTYPE=linux-gnu
+HOME=/home/mike
+TERM=xterm
+SSH_AUTH_SOCK=/tmp/ssh-ApDG1263/agent.1263
+PATH=/home/mike/debian/metamail-2.7/src/metamail/.libs:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
+_=/usr/bin/printenv
+Metamail Version 2.7, debugging turned on.
+Trying to open input file: ../../../../metamailtest
+Date: Wed, 17 Jan 2001 00:39:37 +0100
+From: Stephan Wright <stephan.wright@chello.at>
+To: Wolfgang Hiermann <wolfgang.hiermann@teleweb.at>,         Susanne Schuster <e9107982@student.tuwien.ac.at>,         Roland Summerauer <h9751337@obelix.wu-wien.ac.at>,         Raimund Kirner <e9625030@student.tuwien.ac.at>,         "Michael Mörz" <e9625136@student.tuwien.ac.at>,         Doris Ulrich <e8101579@student.tuwien.ac.at>,         Daniel Wronski <e9625027@student.tuwien.ac.at>,         Balazs Lichtl <e9625772@stud3.tuwien.ac.at>
+Subject: [Fwd: Fw: Das ist aber lieb geschrieben!]
+NEW PARAMETER: boundary VALUE: "------------A0D4511CCFC2DF8B814B1B9E"
+
+Here is the environment:
+
+Handling multipart as built-in here.  Boundary: --------------A0D4511CCFC2DF8B814B1B9E
+NEW PARAMETER: charset VALUE: iso-8859-1
+
+Here is the environment:
+
+Here is the environment:
+
+---Executing: xterm -title 'oding: 8bit  (from Stephan Wright <stephan.wright@chello.at> )' -e  metamail -P -b -c 'text/plain ; charset = iso-8859-1' /tmp/MQxhZtQ
+PWD=/home/mike/debian/metamail-2.7/src/metamail
+XAUTHORITY=/home/mike/.Xauthority
+WINDOWID=20971534
+MM_SUMMARY=inline  (from Stephan Wright <stephan.wright@chello.at> )
+MM_HEADERS=
+Content-Type: message/rfc822
+Content-Transfer-Encoding: 8bit
+Content-Disposition: inline
+
+MM_NOTTTY=1
+MM_QUIET=cat
+HOSTNAME=skair
+DEBFULLNAME=Michael Moerz
+MM_MAILER=unknown
+GDMSESSION=Gnome
+USER=mike
+MACHTYPE=i386-pc-linux-gnu
+DEBEMAIL=e9625136@stud3.tuwien.ac.at
+MAIL=/var/spool/mail/mike
+LANG=C
+DISPLAY=:0.0
+MM_USEPAGER=0
+LOGNAME=mike
+SHLVL=3
+SSH_AGENT_PID=1306
+SESSION_MANAGER=local/skair:/tmp/.ICE-unix/1263
+MM_CONTENTTYPE=message/rfc822
+USERNAME=mike
+SHELL=/bin/bash
+HOSTTYPE=i386
+CVSROOT=:pserver:mike@localhost:/home/repositories
+MM_DEBUG=1
+MM_NOASK=text,text/plain,text/richtext
+MM_RUNASROOT=0
+OSTYPE=linux-gnu
+HOME=/home/mike
+TERM=xterm
+SSH_AUTH_SOCK=/tmp/ssh-ApDG1263/agent.1263
+PATH=/home/mike/debian/metamail-2.7/src/metamail/.libs:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
+_=/usr/bin/printenv
+PWD=/home/mike/debian/metamail-2.7/src/metamail
+XAUTHORITY=/home/mike/.Xauthority
+WINDOWID=20971534
+MM_SUMMARY=Fw: Das ist aber lieb geschrieben   (from "Marion Spahlholz" <Marion.spahlholz@chello.at> )
+MM_HEADERS=
+Return-Path: <Marion.spahlholz@chello.at>
+Received: from marionharald ([213.47.119.62]) by viemta06.chello.at
+          (InterMail vK.4.03.01.00 201-232-122 license 9caa03a7df1d31c048ffcc0d31ac5855)
+          with SMTP id <20010112191934.DEQK23142.viemta06@marionharald>;
+          Fri, 12 Jan 2001 20:19:34 +0100
+Message-ID: <00b301c07ccd$7e71c8e0$3e772fd5@telekabel.at>
+From: "Marion Spahlholz" <Marion.spahlholz@chello.at>
+To: "Peter Ipser" <peter.ipser@chello.at>
+Cc: "Rudolf Meyer" <rudolf.meyer@chello.at>,
+	"Martina Fitzka" <tini@yline.com>,
+	=?iso-8859-1?Q?Evelyn_L=F6wenrosen?= <evelyn.loewenrosen@chello.at>,
+	"Stephan Wright" <stephan.wright@chello.at>
+Subject: Fw: Das ist aber lieb geschrieben!
+Date: Fri, 12 Jan 2001 20:25:59 +0100
+MIME-Version: 1.0
+Content-Type: multipart/mixed;
+	boundary="----=_NextPart_000_00B0_01C07CD5.E0149F20"
+X-Priority: 3
+X-MSMail-Priority: Normal
+X-Mailer: Microsoft Outlook Express 5.50.4133.2400
+X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
+
+MM_NOTTTY=1
+MM_QUIET=cat
+HOSTNAME=skair
+DEBFULLNAME=Michael Moerz
+MM_MAILER=unknown
+GDMSESSION=Gnome
+USER=mike
+MACHTYPE=i386-pc-linux-gnu
+DEBEMAIL=e9625136@stud3.tuwien.ac.at
+MAIL=/var/spool/mail/mike
+LANG=C
+DISPLAY=:0.0
+MM_USEPAGER=0
+LOGNAME=mike
+SHLVL=3
+SSH_AGENT_PID=1306
+SESSION_MANAGER=local/skair:/tmp/.ICE-unix/1263
+MM_CONTENTTYPE=multipart/mixed ; boundary = "----=_NextPart_000_00B0_01C07CD5.E0149F20"
+USERNAME=mike
+SHELL=/bin/bash
+HOSTTYPE=i386
+CVSROOT=:pserver:mike@localhost:/home/repositories
+MM_DEBUG=1
+MM_NOASK=text,text/plain,text/richtext
+MM_RUNASROOT=0
+OSTYPE=linux-gnu
+HOME=/home/mike
+TERM=xterm
+SSH_AUTH_SOCK=/tmp/ssh-ApDG1263/agent.1263
+PATH=/home/mike/debian/metamail-2.7/src/metamail/.libs:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
+_=/usr/bin/printenv
+PWD=/home/mike/debian/metamail-2.7/src/metamail
+XAUTHORITY=/home/mike/.Xauthority
+WINDOWID=20971534
+MM_SUMMARY=Fw: Das ist aber lieb geschrieben   (from "Marion Spahlholz" <Marion.spahlholz@chello.at> )
+MM_HEADERS=
+Content-Type: text/plain;
+	charset="iso-8859-1"
+Content-Transfer-Encoding: 8bit
+
+MM_NOTTTY=1
+MM_QUIET=cat
+HOSTNAME=skair
+DEBFULLNAME=Michael Moerz
+MM_MAILER=unknown
+GDMSESSION=Gnome
+USER=mike
+MACHTYPE=i386-pc-linux-gnu
+DEBEMAIL=e9625136@stud3.tuwien.ac.at
+MAIL=/var/spool/mail/mike
+LANG=C
+DISPLAY=:0.0
+MM_USEPAGER=0
+LOGNAME=mike
+SHLVL=3
+SSH_AGENT_PID=1306
+SESSION_MANAGER=local/skair:/tmp/.ICE-unix/1263
+MM_CONTENTTYPE=text/plain ; charset = "iso-8859-1"
+USERNAME=mike
+SHELL=/bin/bash
+HOSTTYPE=i386
+CVSROOT=:pserver:mike@localhost:/home/repositories
+MM_DEBUG=1
+MM_NOASK=text,text/plain,text/richtext
+MM_RUNASROOT=0
+OSTYPE=linux-gnu
+HOME=/home/mike
+TERM=xterm
+SSH_AUTH_SOCK=/tmp/ssh-ApDG1263/agent.1263
+PATH=/home/mike/debian/metamail-2.7/src/metamail/.libs:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
+_=/usr/bin/printenv
+PWD=/home/mike/debian/metamail-2.7/src/metamail
+XAUTHORITY=/home/mike/.Xauthority
+WINDOWID=20971534
+MM_SUMMARY=Fw: Das ist aber lieb geschrieben   (from "Marion Spahlholz" <Marion.spahlholz@chello.at> )
+MM_HEADERS=
+Content-Type: text/plain;
+	charset="iso-8859-1"
+Content-Transfer-Encoding: 8bit
+
+MM_NOTTTY=0
+MM_QUIET=cat
+HOSTNAME=skair
+DEBFULLNAME=Michael Moerz
+MM_MAILER=unknown
+GDMSESSION=Gnome
+USER=mike
+MACHTYPE=i386-pc-linux-gnu
+DEBEMAIL=e9625136@stud3.tuwien.ac.at
+MAIL=/var/spool/mail/mike
+LANG=C
+DISPLAY=:0.0
+MM_USEPAGER=0
+LOGNAME=mike
+SHLVL=3
+SSH_AGENT_PID=1306
+SESSION_MANAGER=local/skair:/tmp/.ICE-unix/1263
+MM_CONTENTTYPE=text/plain ; charset = "iso-8859-1"
+USERNAME=mike
+SHELL=/bin/bash
+HOSTTYPE=i386
+CVSROOT=:pserver:mike@localhost:/home/repositories
+MM_DEBUG=1
+MM_NOASK=text,text/plain,text/richtext
+MM_RUNASROOT=0
+OSTYPE=linux-gnu
+HOME=/home/mike
+TERM=xterm
+SSH_AUTH_SOCK=/tmp/ssh-ApDG1263/agent.1263
+PATH=/home/mike/debian/metamail-2.7/src/metamail/.libs:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
+_=/usr/bin/printenv
+Command exit status: 0
+‡(­û‡ƒ@‡ƒ@‡ƒ@‡ƒ@‡ƒ@‡ƒ@‡ƒ@ˆƒ@
+Here is the environment:
+
+From: "Marion Spahlholz" <Marion.spahlholz@chello.at>
+To: "Peter Ipser" <peter.ipser@chello.at>
+Cc: "Rudolf Meyer" <rudolf.meyer@chello.at>,  "Martina Fitzka" <tini@yline.com>,  [** iso-8859-1 charset **] Evelyn Löwenrosen‡(­û‡ƒ@‡ƒ@‡ƒ@‡ƒ@‡ƒ@‡ƒ@‡ƒ@ˆƒ@<evelyn.loewenrosen@chello.at>,  "Stephan Wright" <stephan.wright@chello.at>
+Subject: Fw: Das ist aber lieb geschrieben!
+Date: Fri, 12 Jan 2001 20:25:59 +0100
+MIME-Version: 1.0
+NEW PARAMETER: boundary VALUE: "----=_NextPart_000_00B0_01C07CD5.E0149F20"
+X-Priority: 3
+X-MSMail-Priority: Normal
+X-Mailer: Microsoft Outlook Express 5.50.4133.2400
+X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
+
+
+Here is the environment:
+
+Handling multipart as built-in here.  Boundary: ------=_NextPart_000_00B0_01C07CD5.E0149F20
+NEW PARAMETER: charset VALUE: "iso-8859-1"
+
+Here is the environment:
+
+Here is the environment:
+
+---Executing: xterm -title 'Fw: Das ist aber lieb geschrieben   (from "Marion Spahlholz" <Marion.spahlholz@chello.at> )' -e  metamail -P -b -c 'text/plain ; charset = "iso-8859-1"' /tmp/MGsYu2s
+PWD=/home/mike/debian/metamail-2.7/src/metamail
+XAUTHORITY=/home/mike/.Xauthority
+WINDOWID=20971534
+MM_SUMMARY=attachment;  filename="Fortflanzung.gif"  (from "Marion Spahlholz" <Marion.spahlholz@chello.at> )
+MM_HEADERS=
+Content-Type: image/gif;
+	name="Fortflanzung.gif"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment;
+	filename="Fortflanzung.gif"
+
+MM_NOTTTY=1
+MM_QUIET=cat
+HOSTNAME=skair
+DEBFULLNAME=Michael Moerz
+MM_MAILER=unknown
+GDMSESSION=Gnome
+USER=mike
+MACHTYPE=i386-pc-linux-gnu
+DEBEMAIL=e9625136@stud3.tuwien.ac.at
+MAIL=/var/spool/mail/mike
+LANG=C
+DISPLAY=:0.0
+MM_USEPAGER=0
+LOGNAME=mike
+SHLVL=3
+SSH_AGENT_PID=1306
+SESSION_MANAGER=local/skair:/tmp/.ICE-unix/1263
+MM_CONTENTTYPE=image/gif ; name = "Fortflanzung.gif"
+USERNAME=mike
+SHELL=/bin/bash
+HOSTTYPE=i386
+CVSROOT=:pserver:mike@localhost:/home/repositories
+MM_DEBUG=1
+MM_NOASK=text,text/plain,text/richtext
+MM_RUNASROOT=0
+OSTYPE=linux-gnu
+HOME=/home/mike
+TERM=xterm
+SSH_AUTH_SOCK=/tmp/ssh-ApDG1263/agent.1263
+PATH=/home/mike/debian/metamail-2.7/src/metamail/.libs:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
+_=/usr/bin/printenv
--- metamail-2.7.orig/src/metamail/metamail_default.h
+++ metamail-2.7/src/metamail/metamail_default.h
@@ -0,0 +1,9 @@
+#ifndef METAMAIL_DEFAULT_H
+#define METAMAIL_DEFAULT_H 1
+
+char *mmversion = MM_VERSTRING;
+char *NoAskDefault = "text,text/plain,text/richtext";
+char *QuietDefault = CATCOMMAND;
+char *tmproot="";
+
+#endif /* METAMAIL_DEFAULT_H */
--- metamail-2.7.orig/src/metamail/includeaway
+++ metamail-2.7/src/metamail/includeaway
@@ -0,0 +1,97 @@
+#ifdef BORLAND
+#define F_OK 0
+extern unsigned _stklen = 16384;
+extern char *mktemp(char *);
+#define WRITE_BINARY	"w"
+#else /* BORLAND */
+#ifdef MICROSOFT
+#include <malloc.h>
+#include <stdlib.h>
+#include <time.h>
+#include <signal.h>
+#define F_OK 0
+#else
+
+#ifndef AMIGA
+#ifdef SYSV
+//#include <termio.h>
+//#include <unistd.h>
+#else /* SYSV */
+#include <sgtty.h>
+#endif /* SYSV */
+#endif /* AMIGA */
+#endif /* MICROSOFT */
+#endif /* BORLAND */
+
+//#if defined(SYSV) && !defined(linux)
+//#define LPRTEMPLATE "lp %s"
+//#define LPRCOMMAND "lp"
+//#else
+//#define LPRTEMPLATE "lpr %s"
+//#define LPRCOMMAND "lpr"
+
+#endif
+#ifdef MSDOS
+#define CATCOMMAND  "cat"
+#define CATTEMPLATE "cat %s"
+#define METAMAIL    "metamail"
+#define TMPFILE_NAME_SIZE   128
+#define MAX_FILE_NAME_SIZE 128
+#define WRITE_BINARY	"wb"
+#else /* MSDOS */
+#ifdef AMIGA
+extern char *MkRmScript();
+#ifndef F_OK
+#define F_OK (0)
+#endif
+#define CATCOMMAND  "Type"
+#define CATTEMPLATE "Type %s"
+#define METAMAIL    "metamail <*"
+#define TMPFILE_NAME_SIZE     50
+#define MAX_FILE_NAME_SIZE 256
+#define WRITE_BINARY	"w"
+#else /* AMIGA */
+//extern char **environ, *gets();
+//#define CATCOMMAND  "cat"
+//#define CATTEMPLATE "cat %s"
+//#define METAMAIL    "metamail"
+//#define TMPFILE_NAME_SIZE   1000
+//#define MAX_FILE_NAME_SIZE 1000
+//#define WRITE_BINARY	"w"
+#endif /* AMIGA */
+#endif /* MSDOS */
+
+//#ifndef NO_RLIMITS
+//#include <sys/resource.h>
+//#endif
+
+//#define CMDSIZE 1200 /* Maximum size of command to execute */
+
+//#define LINE_BUF_SIZE       2000
+
+#ifndef MICROSOFT
+extern char *malloc();
+extern char *realloc();
+#endif
+
+//extern FILE *popen();
+//static char *nomem = "Out of memory!";
+//static char *mmversion = MM_VERSTRING;
+//static char *NoAskDefault = "text,text/plain,text/richtext";
+//static char *QuietDefault = CATCOMMAND;
+//static char *tmproot="";
+
+//#define ENCODING_NONE 0
+//#define ENCODING_BASE64 1
+//#define ENCODING_QUOTEDPRINTABLE 2
+//#define ENCODING_8BIT 3
+//#define ENCODING_UUENCODE -1	/* non-standard */
+
+#ifdef MICROSOFT
+/* Need a function prototype for TryMailcapEntry because without it MSC
+ * passes a pointer to the structure rather than the structure itself.
+ */
+TryMailcapEntry(struct MailcapEntry mc, char *SquirrelFile);
+#endif
+
+
--- metamail-2.7.orig/src/metamail/mailcap.c
+++ metamail-2.7/src/metamail/mailcap.c
@@ -0,0 +1,118 @@
+/*
+Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
+
+Permission to use, copy, modify, and distribute this material 
+for any purpose and without fee is hereby granted, provided 
+that the above copyright notice and this permission notice 
+appear in all copies, and that the name of Bellcore not be 
+used in advertising or publicity pertaining to this 
+material without the specific, prior written permission 
+of an authorized representative of Bellcore.  BELLCORE 
+MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
+OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
+WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+*/
+/* mailcap.c - contains functions to access and parse mailcap files
+    Authors:  Nathaniel S. Borenstein, Bellcore
+              Michael Moerz <mikem@debian.org>
+*/
+
+#include <metamail/common.h>
+
+#include "mailcap.h"
+#include "metamail.h"
+
+/* Only one or the other set up builtins gets used,
+  depending on whether or not we're in the middle of 
+          a multipart/alternative body part */
+struct MailcapEntry BuiltIns[] = {
+    {"text/*", CATTEMPLATE, NULL, 0, 1, 0, "plain text", LPRTEMPLATE},
+    {NULL, NULL, NULL, 0, 0, 0}};
+
+struct MailcapEntry BuiltInsAlternative[] = {
+    {"text/plain", CATTEMPLATE, NULL, 0, 1, 0, "plain text", LPRTEMPLATE},
+    {NULL, NULL, NULL, 0, 0, 0}};
+
+/** hmm, ... 
+*/
+int
+ProcessMailcapFiles(SquirrelFile) 
+char *SquirrelFile;
+{
+    char *s, *pathcopy = NULL;
+    char *path = getenv("MAILCAPS");
+    if (!path) {
+        uid_t uid = getuid();
+        struct passwd *p;
+        p = getpwuid(uid);
+	if (p) {
+	  path = XMALLOC(char, 5 + strlen(p->pw_dir) + strlen(STDPATH));
+	}
+        strcpy(path, p->pw_dir);
+        strcat(path, STDPATH);
+        pathcopy = path;
+    } else 
+    {
+        pathcopy = XMALLOC(char, 1+strlen(path));
+        strcpy(pathcopy, path);
+        path = pathcopy;
+    }
+    while(path) {
+        s = index(path, PATH_SEPARATOR);
+        if (s) *s++ = 0;
+        if (!ProcessMailcapFile(path, SquirrelFile)) return(0);
+        path = s;
+    }
+    if (pathcopy) XFREE(pathcopy);
+    return(-1);
+}
+
+int
+TryBuiltIns(SquirrelFile) 
+char *SquirrelFile;
+{
+  int i;
+  /* Last resort -- for sites that didn't bother putting a "text" line in 
+     their mailcap files... */
+  if (DoDebug) 
+    fprintf(stderr, "Looking for '%s' in built-in content-type handling "
+	    "settings.\n", ContentType);
+  for (i=0; BuiltIns[i].contenttype; ++i) {
+    if (!TryMailcapEntry(SquirrelFile ? BuiltInsAlternative[i] : BuiltIns[i], SquirrelFile))
+      return(0);
+  }
+  return(-1);
+}
+
+int
+ProcessMailcapFile(file, SquirrelFile)
+char *file, *SquirrelFile;
+{
+    struct MailcapEntry mc;
+    FILE *fp;
+    int res;
+
+    res = IsDirectory(file);
+    if (res) {
+	if (res == 1) {
+	    fprintf(stderr, "Mailcap path entry '%s' is a directory, should be a readable file.\n", file);
+	} else if (DoDebug) {
+	/* Quietly ignore non-existent mailcap files unless debugging */
+	    fprintf(stderr, "Mailcap path entry '%s' does not exist.\n", file);
+	}
+	return(-1);
+    }
+    fp = fopen(file, "r");
+    if (DoDebug) fprintf(stderr, "Looking for '%s' in mailcap file '%s'.\n", ContentType, file);
+    while (fp && !feof(fp)) {
+        mc.needtofree = 0;
+	if (GetMailcapEntry(fp, &mc)) {
+            if (!TryMailcapEntry(mc, SquirrelFile)) {
+                fclose(fp);
+                return(0);
+            }
+	}
+    }
+    if (fp) fclose(fp);
+    return(-1);
+}
--- metamail-2.7.orig/src/metamail/mailcap.h
+++ metamail-2.7/src/metamail/mailcap.h
@@ -0,0 +1,34 @@
+/*
+Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
+
+Permission to use, copy, modify, and distribute this material 
+for any purpose and without fee is hereby granted, provided 
+that the above copyright notice and this permission notice 
+appear in all copies, and that the name of Bellcore not be 
+used in advertising or publicity pertaining to this 
+material without the specific, prior written permission 
+of an authorized representative of Bellcore.  BELLCORE 
+MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
+OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
+WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+*/
+
+#ifndef METAMAIL_MAILCAP_H
+#define METAMAIL_MAILCAP_H 1
+
+struct MailcapEntry {
+  char *contenttype;
+  char *command;
+  char *testcommand;
+  int needsterminal;
+  int copiousoutput;
+  int needtofree;
+  char *label;
+  char *printcommand;
+};
+
+int  ProcessMailcapFiles (char *);
+int  TryBuiltIns         (char *);
+int  ProcessMailcapFile  (char *, char*);
+
+#endif /* METAMAIL_MAILCAP_H */
--- metamail-2.7.orig/src/metamail/shared.c
+++ metamail-2.7/src/metamail/shared.c
@@ -0,0 +1,120 @@
+#include <stdio.h>
+#include <ctype.h>
+#include <config.h>
+#include <stdlib.h>  /* malloc(3) and realloc(3) */
+#ifdef SYSV
+#include <unistd.h>
+#include <sys/utsname.h>
+#endif
+
+char **Exceptions;
+int *NeedsPortableNewlines;
+int ExceptionsAlloced = 0, ExceptionsUsed = 0;
+
+ExceptionalNewline(contenttype, needsportable)
+char *contenttype;
+int needsportable;
+{
+    char *s;
+    if (ExceptionsAlloced == 0) {
+        ExceptionsAlloced = 25;
+        Exceptions = (char **) malloc(ExceptionsAlloced * sizeof(char *));
+        NeedsPortableNewlines = (int *) malloc(ExceptionsAlloced * sizeof(int));
+        if (!Exceptions || !NeedsPortableNewlines) return(-1);
+    }
+    if (ExceptionsUsed >= ExceptionsAlloced) {
+        ExceptionsAlloced += 25;
+        Exceptions = (char **) realloc(Exceptions, ExceptionsAlloced * sizeof(char *));
+        NeedsPortableNewlines = (int *) realloc(NeedsPortableNewlines, ExceptionsAlloced * sizeof(int));
+        if (!Exceptions || !NeedsPortableNewlines) return(-1);
+    }
+    s = malloc(1+strlen(contenttype));
+    if (!s) return(-1);
+    strcpy(s, contenttype);
+    Exceptions[ExceptionsUsed] = s;
+    for (; *s; ++s) {
+        if (isupper((unsigned char) *s)) *s = tolower((unsigned char) *s);
+    }
+    NeedsPortableNewlines[ExceptionsUsed] = needsportable;
+    ++ExceptionsUsed;
+    return(0);
+}
+
+DoesNeedPortableNewlines(ctype)
+char *ctype;
+{
+    int i;
+
+    /* First, handle the customization/override case */
+    for (i=0; i<ExceptionsUsed; ++i) {
+        if (!lc2strcmp(ctype, Exceptions[i])) {
+             return(NeedsPortableNewlines[i]);
+        }
+    }
+    /* But for most folks, the simple defaults will always suffice */
+    if (!lc2strncmp(ctype, "text", 4)) {
+        return(1);
+    }
+    /* The following two are weird; message & multipart should never be encoded, but they really are line-oriented, so if they ARE encoded (and for PEM, it is even legitimate) they should use portable newlines */
+    if (!lc2strncmp(ctype, "message", 7)) {
+        return(1);
+    }
+    if (!lc2strncmp(ctype, "multipart", 9)) {
+        return(1);
+    }
+    return(0);
+}
+
+lc2strncmp(s1, s2, len)
+char *s1, *s2;
+int len;
+{
+    if (!s1 || !s2) return (-1);
+    while (*s1 && *s2 && len > 0) {
+	if (*s1 != *s2 && (tolower(*s1) != *s2)) return(-1);
+	++s1; ++s2; --len;
+    }
+    if (len <= 0) return(0);
+    return((*s1 == *s2) ? 0 : -1);
+}
+
+lc2strcmp(s1, s2)
+char *s1, *s2;
+{
+    if (!s1 || !s2) return (-1);
+    while (*s1 && *s2) {
+	if (*s1 != *s2 && (tolower(*s1) != *s2)) return(-1);
+	++s1; ++s2;
+    }
+    return((*s1 == *s2) ? 0 : -1);
+}
+
+char *getmyname() {
+    static int initialized = 0;
+#ifdef SYSV
+    static struct utsname u;
+    static char *hostname = u.nodename;
+#else
+    static char hostname[60];
+#endif
+    if (!initialized) {
+#ifdef AMIGA
+        strcpy(hostname, myAddress);
+#else
+#ifdef SYSV
+    if (uname(&u) == -1) {
+        hostname = "UNKNOWN.SITE.NAME";
+    }
+#else
+#ifdef MSDOS
+    strcpy(hostname, "UNKNOWN.SITE.NAME");
+#else
+        gethostname(hostname, sizeof(hostname));
+#endif /* MSDOS */
+#endif /* SYSV */
+#endif /* AMIGA */
+        initialized = 1;
+    }
+    return(hostname);
+}
+
--- metamail-2.7.orig/src/metamail/splitmail.c
+++ metamail-2.7/src/metamail/splitmail.c
@@ -0,0 +1,433 @@
+/*
+Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
+
+Permission to use, copy, modify, and distribute this material 
+for any purpose and without fee is hereby granted, provided 
+that the above copyright notice and this permission notice 
+appear in all copies, and that the name of Bellcore not be 
+used in advertising or publicity pertaining to this 
+material without the specific, prior written permission 
+of an authorized representative of Bellcore.  BELLCORE 
+MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
+OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
+WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+*/
+/****************************************************** 
+    Metamail -- A tool to help diverse mail readers 
+                cope with diverse multimedia mail formats.
+
+    Author:  Nathaniel S. Borenstein, Bellcore
+
+ ******************************************************* */
+
+#include <metamail/common.h>
+
+#define MINCHUNKSIZE 20000 /* Better be enough to hold the headers, or we die! */
+
+extern char *getenv();
+#define NORMALDELIVERYCMD "/usr/sbin/sendmail -t -oi"
+#define VERBOSEDELIVERYCMD "/usr/sbin/sendmail -t -v -oi"
+
+usageexit() {
+    fprintf(stderr, "Usage:  splitmail [-d] [-v] [-s splitsize] [-i id-suffix] [-p prefix] [file-name]\n");
+    exit(-1);
+}
+
+char *MonthNames[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
+char *DayNames[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
+
+char *
+endofheader(s)
+char *s;
+{
+    char *orgs = s, c;
+    while (1) {
+	s = index(s, '\n');
+	if (!s) return(orgs+strlen(orgs));
+	c = *(s+1);
+        if (c != ' ' && c != '\t') return(s);
+        ++s;
+    }
+}
+
+main(argc, argv)
+char **argv;
+{
+    int i, DoDeliver=0, SplitSize=DEFAULT_SPLIT_SIZE, dum, InNewline=1, bytesread, whichpart=1, Verbose=0, numparts = -1, c;
+    char *fname = NULL, *bigbuf, *s, *SharedHeaders, *headend, *from, id[100], *deliverycmd, *prefix, SubjectBuf[250];
+    char *MessageID = 0, *OrigID=NULL;
+    FILE *fp;
+
+    s = getenv("METAMAIL_TMPDIR");
+    if (s) {
+        prefix = malloc(10+strlen(s));
+        if (!prefix) {
+            fprintf(stderr, "splitmail: Not enough memory\n");
+            exit(-1);
+        }
+        sprintf(prefix, "%s/split.", s);
+    } else {
+        prefix = "/tmp/split.";
+    }
+    s = getenv("SPLITSIZE");
+    if (s) {
+        dum = atoi(s);
+        if (dum < MINCHUNKSIZE) {
+            fprintf(stderr, "Ignoring SPLITSIZE environment variable of %d -- the minimum value is %d\n", dum, MINCHUNKSIZE);
+        } else {
+            SplitSize = dum;
+        }
+    }
+    for (i=1; i<argc; ++i) {
+	if (argv[i][0] == '-') {
+	    switch (argv[i][1]) {
+		case 's':
+		    if (++i >= argc) usageexit();
+		    dum = atoi(argv[i]);
+		    if (dum < MINCHUNKSIZE && dum >= 0) {
+			fprintf(stderr, "splitmail: Using minimum splitsize of %d\n", MINCHUNKSIZE);
+			dum = MINCHUNKSIZE;
+			
+		    }
+		    SplitSize = dum;
+		    break;
+		case 'd':
+		    DoDeliver = 1;
+                    break;
+                case 'p':
+		    if (++i >= argc) usageexit();
+                    prefix = argv[i];
+                    break;
+ 		case 'i':
+ 		    if( ++i >= argc) usageexit();
+ 		    MessageID = argv[i];
+ 		    break;
+		case 'v':
+		    Verbose = 1;
+		    break;
+		default:
+		    usageexit();
+	    }
+	} else {
+	    if (fname) usageexit();
+	    fname = argv[i];
+	}
+    }
+    bigbuf = malloc(100+SplitSize);
+    if (!bigbuf) {
+	fprintf(stderr, "splitmail:  Not enough memory for %d-byte chunks\n", SplitSize);
+	exit(-1);
+    }
+    SplitSize -= 1000; /* gives fudge factor for headers, line endings */
+    if (fname) {
+        struct stat stbuf;
+        if (!stat(fname, &stbuf)) {
+            /* Note:  this will sometimes be 1 too high when it is a very close call,
+              because of the desire to have complete lines.  In such cases, we send
+              a null final part */
+            numparts = 1 + (stbuf.st_size / SplitSize);
+        }
+	fp = fopen(fname, "r");
+	if (!fp) {
+	    fprintf(stderr, "splitmail: Cannot read file %s\n", fname);
+	    exit(-1);
+	}
+    } else fp = stdin;
+    headend = bigbuf;
+    while((c=getc(fp)) != EOF) {
+        if (headend >= bigbuf + SplitSize) {
+            fprintf(stderr, "splitmail: Could not find the end of the headers!\n");
+            exit(-1);
+        }
+	*headend++ = c;
+	if (c == '\n') {
+	    if (InNewline) break; /* end of headers */
+	    InNewline = 1;
+	} else {
+	    InNewline = 0;
+	}
+    }
+    if (c == EOF) {
+	fprintf(stderr, "splitmail: Could not find the end of the headers!\n");
+	exit(-1);
+    }
+    *headend = '\0';
+    SharedHeaders = malloc(1+strlen(bigbuf)); /* maximum size needed */
+    if (!SharedHeaders) {
+	fprintf(stderr, "splitmail: Not enough memory\n");
+	exit(-1);
+    }
+    from = bigbuf;
+    *SharedHeaders = '\0';
+    strcpy(SubjectBuf, "Partial Message");
+    while (from < headend) {
+	s = endofheader(from);  /* would be index(from, '\n'),
+				 but need to check for continuation lines */
+        *s = '\0';
+	if (ShareThisHeader(from, SubjectBuf, sizeof (SubjectBuf), &OrigID)) {
+	    strcat(SharedHeaders, from);
+	    strcat(SharedHeaders, "\n");
+	}
+	*s = '\n';
+	from = ++s;
+    }
+    //#ifdef AMIGA
+    //snprintf(id, sizeof(id), "%d.%s@%s%s", time(0), SeqToName(GetSequence(4)), FindConfig("NodeName"),
+    //       FindConfig("DomainName"));
+    //#else
+    //#ifdef MSDOS
+    //snprintf(id, sizeof(id), "%ld.UNKNOWN.SITE.NAME", time(NULL)); // BCR
+    //#else
+    snprintf(id, sizeof(id), "%d.%d.%d.%s", (int) getuid(), (int) getpid(), (int) time(0), getmyname());
+    //#endif /* MSDOS */
+    //#endif /* AMIGA */
+    bytesread = headend - bigbuf;
+    deliverycmd = Verbose ? VERBOSEDELIVERYCMD : NORMALDELIVERYCMD;
+    while (!feof(fp)) {
+	while (SplitSize > bytesread && !feof(fp)) {
+	    /* Need to loop because fread is weird */
+	    bytesread += fread(bigbuf + bytesread, sizeof(char), SplitSize - bytesread, fp);
+	}
+	/* Now complete the line */
+	while((c=getc(fp)) != EOF) {
+	    bigbuf[bytesread++] = c;
+	    if (c=='\n') break;
+	}
+        bigbuf[bytesread] = '\0';
+        if (feof(fp) && numparts <= 0) numparts = whichpart;
+        HandleOnePart(DoDeliver, deliverycmd, prefix, numparts, whichpart, SharedHeaders, SubjectBuf, id, MessageID, bigbuf, OrigID);
+	bytesread = 0;
+	++whichpart;
+    }
+    while (whichpart <= numparts) {
+        /* Our guess as to how many parts was OFF, hopefully only by one */
+        *bigbuf = '\0'; /* have to deliver an empty part, ugh! */
+        HandleOnePart(DoDeliver, deliverycmd, prefix, numparts, whichpart, SharedHeaders, SubjectBuf, id, MessageID, bigbuf, OrigID);
+        ++whichpart;
+    }
+    return(0);
+}
+
+HandleOnePart(DoDeliver, deliverycmd, prefix, numparts, whichpart, SharedHeaders, SubjectBuf, id, MessageID, bigbuf, OrigID)
+int DoDeliver, numparts, whichpart;
+char *deliverycmd, *prefix, *SharedHeaders, *SubjectBuf, *id, *MessageID, *bigbuf, *OrigID;
+{
+    FILE *fpout;
+    char OutputFile[1000];
+    int code;
+    //    struct  timeval	tp;
+    // struct  timezone	tzp;
+    char    *tm_zone;
+
+    if (DoDeliver) {
+        fpout = popen(deliverycmd, "w");
+    } else {
+    	int fd;
+        snprintf(OutputFile, sizeof(OutputFile), "%s%d", prefix, whichpart);
+        remove(OutputFile);
+        fpout = NULL;
+        fd = open(OutputFile, O_WRONLY|O_CREAT|O_EXCL, 0600);
+        if (fd != -1) fpout = fdopen(fd, "w");
+    }
+    if (!fpout) {
+	fprintf(stderr, "splitmail: Can't open %s for writing\n", DoDeliver ? deliverycmd : OutputFile);
+        exit(-1);
+    }
+    if (numparts != 1) { /* one-parters end up not changed at all! */
+        struct tm *gt;
+        time_t clock;
+        int secsoff, hrsoff, minsoff;
+        char signoff='+';
+
+	fputs(SharedHeaders, fpout);
+	if (OrigID) fprintf(fpout, "References: %s\n", OrigID);
+
+        clock=time(0);
+        gt = (struct tm*) gmtime(&clock);
+        hrsoff=minsoff=0;
+        fprintf(fpout, "Date: %s, %02d %s %d %02d:%02d:%02d %c%02d%02d (GMT)\n", DayNames[gt->tm_wday],
+                 gt->tm_mday, MonthNames[gt->tm_mon], 1900+gt->tm_year, gt->tm_hour,
+                 gt->tm_min, gt->tm_sec, signoff, hrsoff, minsoff);
+	//#else
+        //clock=time(0);
+        //gt = localtime(&clock);
+	//gettimeofday(&tp, &tzp);
+	//tm_zone = (char *)timezone(tzp.tz_minuteswest, gt->tm_isdst);
+	//secsoff = tzp.tz_minuteswest * 60;
+	//#else
+        secsoff= gt->tm_gmtoff;
+	//#endif
+        if (secsoff < 0) {
+            signoff = '-';
+            secsoff *= -1;
+        }
+        hrsoff = secsoff / 3600;
+        minsoff = (secsoff - (3600*hrsoff)) / 60;
+        fprintf(fpout, "Date: %s, %02d %s %d %02d:%02d:%02d %c%02d%02d (%s)\n",
+		DayNames[gt->tm_wday], gt->tm_mday, MonthNames[gt->tm_mon],
+		1900+gt->tm_year, gt->tm_hour, 
+		gt->tm_min, gt->tm_sec, signoff, hrsoff, minsoff, gt->tm_zone);
+
+        if( MessageID) {
+            fprintf(fpout, "Message-Id: <%d.%s.%s>\n",whichpart,id,MessageID);
+        }
+        fprintf(fpout, "Subject: %s (part %d of ", SubjectBuf, whichpart);
+        if (numparts > 0) {
+            fprintf(fpout, "%d)\n", numparts);
+        } else {
+            fprintf(fpout, "several)\n");
+        }
+        fprintf(fpout, "Content-type: message/partial; id=\"%s\"; number=%d", id, whichpart);
+        if (numparts > 0) fprintf(fpout, "; total=%d", numparts);
+        fprintf(fpout, "\nMIME-Version: 1.0\n\n");
+    }
+    fputs(bigbuf, fpout);
+    code = DoDeliver ? pclose(fpout) : fclose(fpout);
+    if (code) {
+        fprintf(stderr, "splitmail: %s of part %d failed\n", DoDeliver ? "Delivery" : "Writing", whichpart);
+        if (whichpart > 1) fprintf(stderr, "  (previous %d parts may have succeeded)\n", whichpart -1);
+        exit(-1);
+    }
+}
+
+static char *SharedHeads[] = {
+    "from",
+    "to",
+    "cc",
+    "bcc",
+    "newsgroup",
+    "newsgroups",
+    NULL
+};
+
+ShareThisHeader(s, SubjectBuf, size, OrigID)
+char *s;
+char *SubjectBuf;
+size_t size;
+char **OrigID;
+{
+    int i;
+    char *colon = index(s, ':');
+    if (!colon) return(0); /* don't share it in all parts */
+    *colon = '\0';
+    if (!ULstrcmp(s, "message-id")) {
+        *colon = ':';
+	*OrigID = malloc(1+strlen(++colon));
+	if (! *OrigID) {
+	    fprintf(stderr, "splitmail: Not enough memory\n");
+	    exit(-1);
+	}
+	while (*colon && isspace(*colon)) {++colon;}
+        strcpy(*OrigID, colon);
+        return(0);
+    }
+    if (!ULstrcmp(s, "subject")) {
+        *colon = ':';
+        strncpy(SubjectBuf, ++colon, size);
+        SubjectBuf[size - 1] = '\0';
+        return(0);
+    }
+    if (!ULstrcmp(s, "content-type")) {
+        if (IllegalContentType(colon+1)) {
+            fprintf(stderr, "splitmail: message has illegal content-type header, delivery cancelled.\n");
+            exit(-1);
+        }
+    }
+    for (i=0; SharedHeads[i]; ++i) {
+	if (!ULstrcmp(s, SharedHeads[i])) break;
+    }
+    *colon = ':';
+    return(SharedHeads[i] ? 1 : 0);
+}
+
+static char *tspecials = "()<>@,;:\\\"/[]?.=";
+
+IllegalContentType(ctype)
+char *ctype;
+{
+    char *ct, *semicolon, *st, *s, *param, *eq, *matcheq;
+    ct = malloc(1+strlen(ctype));
+    if (!ct) {
+        fprintf(stderr, "splitmail: out of memory!\n");
+        exit(-1);
+    }
+    strcpy(ct, ctype);
+    semicolon = index(ct, ';');
+    if (semicolon) *semicolon = 0;
+    st = index(ct, '/');
+    if (!st) {
+        fprintf(stderr, "Illegal content-type specification: %s\nAll MIME content-type headers must contain a type/subtype specification.\n", ctype);
+        return(-1);
+    }
+    if (st) *st++ = 0;
+    for (s = ct; *s; ++s) {
+        if (!isprint(*s) || index(tspecials, *s)) {
+            fprintf(stderr, "Illegal content-type specification: %s\nThe character '%c' (ASCII %d) is illegal in a MIME content-type.\n", ctype, *s, *s);
+            return(-1);
+        }
+    }
+    for (s = st; s && *s; ++s) {
+        if (!isprint(*s) || index(tspecials, *s)) {
+            fprintf(stderr, "Illegal content-type specification: %s\nThe character '%c' (ASCII %d) is illegal in a MIME content-subtype.\n", ctype, *s, *s);
+            return(-1);
+        }
+    }
+    while (semicolon) {
+        param = ++semicolon;
+        while (*param && isspace(*param)) ++param;
+        semicolon = index(param, ';');
+        if (semicolon) *semicolon = 0;
+        eq = index(param, '=');
+        if (eq) *eq++ = 0;
+        for (s = param; *s; ++s) {
+            if (!isprint(*s) || index(tspecials, *s)) {
+                fprintf(stderr, "Illegal content-type specification: %s\nThe character '%c' (ASCII %d) is illegal in a MIME content-type parameter name.\n", ctype, *s, *s);
+                return(-1);
+            }
+        }
+        while (*eq && isspace(*eq)) ++eq;
+        if (*eq == '\"') {
+            matcheq = eq;
+            do {
+                matcheq = index(matcheq+1, '\"');
+                if (!matcheq) {
+                    fprintf(stderr, "Illegal content-type specification: %s\nA quoted MIME parameter value must have matching quotation marks.\n", ctype);
+                    return(-1);
+                }
+            } while (*(matcheq-1) == '\\');
+            while (*++matcheq) {
+                if (!isspace(*matcheq)) {
+                    fprintf(stderr, "Illegal content-type specification: %s\nA quoted MIME parameter value must stop after the closing quotation mark.\n", ctype);
+                    return(-1);
+                }
+            }
+        } else {
+            for (s = eq; s && *s; ++s) {
+                if (!isprint(*s) || index(tspecials, *s)) {
+                    fprintf(stderr, "Illegal content-type specification: %s\nThe character '%c' (ASCII %d) is illegal in an unquoted MIME parameter value.\n", ctype, *s, *s);
+                    return(-1);
+                }
+            }
+        }
+    }
+    free(ct);
+    return(0);
+}
+
+int ULstrcmp(s1, s2)
+register char *s1, *s2;
+{
+    char c1,c2;
+
+    for(;;) {
+	c1 = *s1++; if (c1 <= 'Z') if (c1 >= 'A') c1 += 040;
+	c2 = *s2++; if (c2 <= 'Z') if (c2 >= 'A') c2 += 040;
+	if (c1 != c2) break;
+	if (c1 == '\0') return(0);
+    }
+    return(c1 - c2);
+}
+
+/* STILL TO DO:  
+  Get number of parts right when possible 
+*/
--- metamail-2.7.orig/src/Makefile.am
+++ metamail-2.7/src/Makefile.am
@@ -0,0 +1,3 @@
+MAINTAINERCLEANFILES	= Makefile.in
+
+SUBDIRS			= metamail richmail
--- metamail-2.7.orig/src/Makefile.in
+++ metamail-2.7/src/Makefile.in
@@ -0,0 +1,298 @@
+# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AS = @AS@
+CATCOMMAND = @CATCOMMAND@
+CC = @CC@
+DLLTOOL = @DLLTOOL@
+ECHO = @ECHO@
+EXEEXT = @EXEEXT@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LN_S = @LN_S@
+LPRCOMMAND = @LPRCOMMAND@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_aux_dir = @ac_aux_dir@
+
+MAINTAINERCLEANFILES = Makefile.in
+
+SUBDIRS = metamail richmail
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = ../metamail/config.h
+CONFIG_CLEAN_FILES = 
+DIST_COMMON =  Makefile.am Makefile.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP_ENV = --best
+all: all-redirect
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
+	cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile
+
+Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
+	cd $(top_builddir) \
+	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+
+@SET_MAKE@
+
+all-recursive install-data-recursive install-exec-recursive \
+installdirs-recursive install-recursive uninstall-recursive  \
+check-recursive installcheck-recursive info-recursive dvi-recursive:
+	@set fnord $(MAKEFLAGS); amf=$$2; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+	@set fnord $(MAKEFLAGS); amf=$$2; \
+	dot_seen=no; \
+	rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
+	  rev="$$subdir $$rev"; \
+	  test "$$subdir" != "." || dot_seen=yes; \
+	done; \
+	test "$$dot_seen" = "no" && rev=". $$rev"; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS)'; \
+	unique=`for i in $$list; do echo $$i; done | \
+	  awk '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	here=`pwd` && cd $(srcdir) \
+	  && mkid -f$$here/ID $$unique $(LISP)
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+   if test "$$subdir" = .; then :; else \
+	    test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+   fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)'; \
+	unique=`for i in $$list; do echo $$i; done | \
+	  awk '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+	  || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags  $$unique $(LISP))
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+	-rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = src
+
+distdir: $(DISTFILES)
+	here=`cd $(top_builddir) && pwd`; \
+	top_distdir=`cd $(top_distdir) && pwd`; \
+	distdir=`cd $(distdir) && pwd`; \
+	cd $(top_srcdir) \
+	  && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign src/Makefile
+	@for file in $(DISTFILES); do \
+	  d=$(srcdir); \
+	  if test -d $$d/$$file; then \
+	    cp -pr $$d/$$file $(distdir)/$$file; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+	    || cp -p $$d/$$file $(distdir)/$$file || :; \
+	  fi; \
+	done
+	for subdir in $(SUBDIRS); do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d $(distdir)/$$subdir \
+	    || mkdir $(distdir)/$$subdir \
+	    || exit 1; \
+	    chmod 777 $(distdir)/$$subdir; \
+	    (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(top_distdir) distdir=../$(distdir)/$$subdir distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+info-am:
+info: info-recursive
+dvi-am:
+dvi: dvi-recursive
+check-am: all-am
+check: check-recursive
+installcheck-am:
+installcheck: installcheck-recursive
+install-exec-am:
+install-exec: install-exec-recursive
+
+install-data-am:
+install-data: install-data-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-recursive
+uninstall-am:
+uninstall: uninstall-recursive
+all-am: Makefile
+all-redirect: all-recursive
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs: installdirs-recursive
+installdirs-am:
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f Makefile $(CONFIG_CLEAN_FILES)
+	-rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+	-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+mostlyclean-am:  mostlyclean-tags mostlyclean-generic
+
+mostlyclean: mostlyclean-recursive
+
+clean-am:  clean-tags clean-generic mostlyclean-am
+
+clean: clean-recursive
+
+distclean-am:  distclean-tags distclean-generic clean-am
+	-rm -f libtool
+
+distclean: distclean-recursive
+
+maintainer-clean-am:  maintainer-clean-tags maintainer-clean-generic \
+		distclean-am
+	@echo "This command is intended for maintainers to use;"
+	@echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-recursive
+
+.PHONY: install-data-recursive uninstall-data-recursive \
+install-exec-recursive uninstall-exec-recursive installdirs-recursive \
+uninstalldirs-recursive all-recursive check-recursive \
+installcheck-recursive info-recursive dvi-recursive \
+mostlyclean-recursive distclean-recursive clean-recursive \
+maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
+dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
+install-exec install-data-am install-data install-am install \
+uninstall-am uninstall all-redirect all-am all installdirs-am \
+installdirs mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
--- metamail-2.7.orig/src/richmail/COMMANDS
+++ metamail-2.7/src/richmail/COMMANDS
@@ -0,0 +1,29 @@
+Commands for changing character sets in richtext:
+
+Japanese:
+
+<iso-2022-jp>		ISO-2022 encoding for mixed US-ASCII and JIS.
+<x-jis-x0201-1976>	Variant of US-ASCII for Japan.
+<x-jis-x0201>		Variant of US-ASCII for Japan.
+<x-jis-x0208-1978>	JIS X 0208-1978
+<x-jis-x0208-1983>	JIS X 0208-1983
+<x-jis-x0208>		JIS X 0208-1983
+
+Korean:
+
+<iso-2022-kr>		ISO-2022 encoding for mixed US-ASCII and Korean.
+<x-ksc-5601>		2-byte encoding of Hangul without shift/escape seqs.
+
+Internal commands:
+
+<x-iso-2022-gen-HH>	Used for ISO-2022 escape seqences.
+<x-iso-shift-in>	SI character
+<x-iso-shift-out>	SO character
+<x-iso-charset-HH>	Used for ISO-2022 ESC$)? character set designators.
+
+Notes:
+
+<iso-2022-*> text sequences may contain ISO-2022 escape sequences for changing
+character sets.  <x-jis-*-*> and <x-ksc-*> text sequences can also contain
+such escape sequences, but they start out in 2-byte mode, and are intended
+mainly for 2-byte character sequences, rather than a mixture.
--- metamail-2.7.orig/src/richmail/NOTES
+++ metamail-2.7/src/richmail/NOTES
@@ -0,0 +1,7 @@
+
+"richtext.c" may be used as a library in another program, by defining the
+macro RICHTEXT_LIBRARY when it is compiled and calling the function
+"richtext_main(argc, argv)" with the arguments set to the normal richtext
+command-line arguments.  It is also necessary to link with "richlex.c",
+"richset.c", "usascii.c" and "iso2022.c" which provide services to
+"richtext.c".
--- metamail-2.7.orig/src/richmail/usascii.c
+++ metamail-2.7/src/richmail/usascii.c
@@ -0,0 +1,129 @@
+/*-------------------------------------------------------------------------
+
+  usascii.c - Code for the US-ASCII specific parts of the richtext processor.
+ 
+  Copyright (c) 1992 Rhys Weatherley
+
+  Permission to use, copy, modify, and distribute this material
+  for any purpose and without fee is hereby granted, provided
+  that the above copyright notice and this permission notice
+  appear in all copies, and that the name of Rhys Weatherley not be
+  used in advertising or publicity pertaining to this
+  material without specific, prior written permission.
+  RHYS WEATHERLEY MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR
+  SUITABILITY OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED
+  "AS IS", WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+
+  Revision History:
+  ================
+
+   Version  DD/MM/YY  By  Description
+   -------  --------  --  --------------------------------------
+     1.0    21/06/92  RW  Original Version of usascii.c
+
+  You may contact the author by:
+  =============================
+
+   e-mail: rhys@cs.uq.oz.au
+     mail: Rhys Weatherley
+	   5 Horizon Drive
+	   Jamboree Heights
+	   Queensland 4074
+	   Australia
+
+-------------------------------------------------------------------------*/
+
+#include <stdio.h>
+#include <metamail/common.h>
+
+#include "richlex.h"
+#include "richset.h"
+
+/*
+ * Initialise the US-ASCII character set processor.
+ */
+usascii_init (name)
+char	*name;
+{
+    if (name)
+	richtextencoding (RICH_ENC_US_ASCII);
+}
+
+/*
+ * Process a command for the US-ASCII processor.
+ */
+int	usascii_command (token,negated)
+char	*token;
+int	negated;
+{
+    if (!strcmp(token,"us-ascii")) {
+    	if (negated) {
+	    charsetpop (&usascii_charset);
+	} else {
+	    charsetpush (&usascii_charset);
+	    richtextencoding (RICH_ENC_US_ASCII);
+	}
+	return (1);
+    } else {
+    	return (0);
+    }
+}
+
+/*
+ * Check for singleton US-ASCII tokens.
+ */
+int	usascii_single (token)
+char	*token;
+{
+    return (0);
+}
+
+/*
+ * Determine the width of a US-ASCII character.
+ */
+int	usascii_width (ch)
+RCHAR	ch;
+{
+    return (1);
+}
+
+/*
+ * Determine if the current character can be used as a folding point.
+ */
+int	usascii_fold (ch)
+RCHAR	ch;
+{
+    return (ch < 0x7F && isspace (ch));
+}
+
+/*
+ * Render the given US-ASCII character.
+ */
+usascii_render (ch,param)
+RCHAR	ch;
+void	*param;
+{
+    (*RichtextPutc) ((int)ch,param);
+}
+
+/*
+ * Enter or leave the US-ASCII encoding.
+ */
+usascii_encoding (newenc)
+int	newenc;
+{
+    /* Nothing to be done in this version */
+}
+
+/*
+ * Define the US-ASCII character set processor.
+ */
+struct 	charsetproc	usascii_charset =
+	  {"us-ascii",
+	   usascii_init,
+	   usascii_command,
+	   usascii_single,
+	   usascii_width,
+	   usascii_fold,
+	   usascii_render,
+	   usascii_encoding};
--- metamail-2.7.orig/src/richmail/iso2022.c
+++ metamail-2.7/src/richmail/iso2022.c
@@ -0,0 +1,375 @@
+/*-------------------------------------------------------------------------
+
+  iso2022.c - Code for the ISO-2022 specific parts of the richtext processor.
+ 
+  Copyright (c) 1992 Rhys Weatherley
+
+  Permission to use, copy, modify, and distribute this material
+  for any purpose and without fee is hereby granted, provided
+  that the above copyright notice and this permission notice
+  appear in all copies, and that the name of Rhys Weatherley not be
+  used in advertising or publicity pertaining to this
+  material without specific, prior written permission.
+  RHYS WEATHERLEY MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR
+  SUITABILITY OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED
+  "AS IS", WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+
+  Revision History:
+  ================
+
+   Version  DD/MM/YY  By  Description
+   -------  --------  --  --------------------------------------
+     1.0    21/06/92  RW  Original Version of iso2022.c
+
+  You may contact the author by:
+  =============================
+
+   e-mail: rhys@cs.uq.oz.au
+     mail: Rhys Weatherley
+	   5 Horizon Drive
+	   Jamboree Heights
+	   Queensland 4074
+	   Australia
+
+  Acknowledgements:
+  ================
+
+  Many thanks to Yutaka Sato (ysato@etl.go.jp) for protyping ISO-2022
+  support in a previous version of richtext, on whose code this is based.
+
+-------------------------------------------------------------------------*/
+
+#include <metamail/common.h>
+
+#include "richlex.h"
+#include "richset.h"
+
+/*
+ * Global data for this module.
+ */
+static	int	SwToAscii;
+static	int	SwToOther;
+static	int	OutPrevChar;
+static	int	OutPrevPrevChar;
+static	int	OutCharLen;
+static	int	OutCharSet;
+static	int	OutAsciiMode;
+
+#define	OUT_ASCII	0
+#define	OUT_JIS		1
+#define	OUT_KSC		2
+
+#define	ESC		033
+#define	SO		016
+#define	SI		017
+
+#define	ISO_GENERIC_PREFIX	"x-iso-2022-gen-"
+#define	ISO_GENERIC_LEN		15
+#define	ISO_SHIFT_PREFIX	"x-iso-shift-"
+#define	ISO_SHIFT_LEN		12
+#define	ISO_CHARSET_PREFIX	"x-iso-charset-"
+#define	ISO_CHARSET_LEN		14
+
+/*
+ * Initialise the ISO-2022 character set processor.
+ */
+iso2022_init (name)
+char	*name;
+{
+    SwToAscii = 'B';
+    SwToOther = 'B';
+    OutPrevChar = 0;
+    OutPrevPrevChar = 0;
+    OutCharLen = 1;
+    OutCharSet = OUT_ASCII;
+    OutAsciiMode = RICH_ENC_US_ASCII;
+    if (!name)
+	return;
+    if (!strncmp (name,"iso-2022-jp",11))
+	richtextencoding (RICH_ENC_JP_ASCII);
+    else if (!strncmp (name,"iso-2022-kr",11)) {
+	richtextencoding (RICH_ENC_KR_ASCII);
+	controloutput("\033$)C",0);
+    } else
+	richtextencoding (RICH_ENC_US_ASCII);
+}
+
+/*
+ * Process a command for the ISO-2022 processor.
+ */
+int	iso2022_command (token,negated)
+char	*token;
+int	negated;
+{
+    int swchar;
+    if (!strcmp(token,"iso-2022-jp")) {
+    	if (negated) {
+	    /* Return to previous output mode */
+	    controloutput("\033(B",0);
+	    SwToAscii = 'B';
+	    charsetpop(&iso2022_charset);
+	} else {
+	    /* Enter JIS-X0208-1983 output mode */
+	    charsetpush(&iso2022_charset);
+	    richtextencoding(RICH_ENC_US_ASCII);
+	    controloutput("\033(B",0);
+	    SwToOther = 'B';
+	}
+	return (1);
+    } else if (!strcmp(token,"iso-2022-kr")) {
+	if (negated) {
+	    /* Return to previous output mode */
+	    controloutput("\017",0);
+	    charsetpop(&iso2022_charset);
+	} else {
+	    /* Enter KSC-5601 output mode */
+	    charsetpush(&iso2022_charset);
+	    richtextencoding(RICH_ENC_KR_ASCII);
+	    controloutput("\033$)C\017",0);
+	}
+	return (1);
+    } else if (!strncmp(token,"x-jis-x0201",11)) {
+    	if (negated) {
+	    /* Return to previous output mode */
+	    controloutput("\033(B",0);
+	    SwToAscii = 'B';
+	    charsetpop(&iso2022_charset);
+	} else {
+	    /* Enter JIS-X-0201-1976 output mode */
+	    charsetpush(&iso2022_charset);
+	    richtextencoding(RICH_ENC_JP_ASCII);
+	    controloutput("\033(J",0);
+	    SwToAscii = 'J';
+	}
+	return (1);
+    } else if (!strncmp(token,"x-jis-x0208",11)) {
+    	if (negated) {
+	    /* Return to previous output mode */
+	    controloutput("\033(B",0);
+	    SwToAscii = 'B';
+	    charsetpop(&iso2022_charset);
+	} else {
+	    /* Enter JIS-X0208-* output mode */
+	    charsetpush(&iso2022_charset);
+	    if (!strcmp (token + 11,"-1978"))
+		SwToOther = '@';
+	    else
+		SwToOther = 'B';
+	    richtextencoding((SwToOther == '@' ? RICH_ENC_JIS_1978 :
+					      RICH_ENC_JIS_1983));
+	    controloutput("\033$",0);
+	    controlputc(SwToOther);
+	}
+	return (1);
+    } else if (!strcmp(token,"x-ksc-5601")) {
+    	if (negated) {
+	    /* Return to previous output mode */
+	    controloutput("\017",0);
+	    charsetpop(&iso2022_charset);
+	} else {
+	    /* Enter KSC-5601 output mode */
+	    charsetpush(&iso2022_charset);
+	    richtextencoding(RICH_ENC_KSC_5601);
+	    controloutput("\033$)C\016",0);
+	}
+	return (1);
+    } else if (!strncmp (token,ISO_GENERIC_PREFIX,ISO_GENERIC_LEN)) {
+    	/* Process an escape sequence for changing character sets */
+	sscanf(token + ISO_GENERIC_LEN,"%x",&swchar);
+	if (swchar <= ' ' || swchar >= 0x7F)
+	    return (1);
+	if (negated) {
+	    /* Return to previous output mode from multi-byte mode */
+	    if (!charsettop(&iso2022_charset))
+	      charsetpush(&iso2022_charset);
+	    richtextencoding((swchar == 'J' ? RICH_ENC_JP_ASCII :
+					      RICH_ENC_US_ASCII));
+	    controloutput("\033(",0);
+	    controlputc(swchar);
+	    SwToAscii = swchar;
+	} else {
+	    /* Enter multi-byte (Japanese) mode */
+	    if (!charsettop(&iso2022_charset))
+	      charsetpush(&iso2022_charset);
+	    richtextencoding((swchar == '@' ? RICH_ENC_JIS_1978 :
+					      RICH_ENC_JIS_1983));
+	    controloutput("\033$",0);
+	    controlputc(swchar);
+	    SwToOther = swchar;
+	}
+	return (1);
+    } else if (!strncmp (token,ISO_SHIFT_PREFIX,ISO_SHIFT_LEN)) {
+    	/* Process a character set shift sequence */
+	if (!strcmp(token + ISO_SHIFT_LEN,"out") &&
+	    	RichtextCharEncoding == RICH_ENC_KR_ASCII) {
+	    /* Enter KSC-5601 2-byte mode */
+	    if (!charsettop(&iso2022_charset))
+	      charsetpush(&iso2022_charset);
+	    richtextencoding(RICH_ENC_KSC_5601);
+	    controloutput("\016",0);
+	} else if (!strcmp (token + ISO_SHIFT_LEN,"in") &&
+		RichtextCharEncoding == RICH_ENC_KSC_5601) {
+	    /* Return to US-ASCII from KSC-5601 */
+	    if (!charsettop(&iso2022_charset))
+	      charsetpush(&iso2022_charset);
+	    richtextencoding(RICH_ENC_KR_ASCII);
+	    controloutput("\017",0);
+	}
+	return (1);
+    } else {
+    	return (0);
+    }
+}
+
+/*
+ * Check for singleton ISO-2022 tokens.
+ */
+int	iso2022_single (token)
+char	*token;
+{
+    return (!strncmp (token,ISO_GENERIC_PREFIX,ISO_GENERIC_LEN) ||
+	    !strncmp (token,ISO_SHIFT_PREFIX,ISO_SHIFT_LEN) ||
+	    !strncmp (token,ISO_CHARSET_PREFIX,ISO_CHARSET_LEN));
+}
+
+/*
+ * Determine the width of a ISO-2022 character.
+ */
+int	iso2022_width (ch)
+RCHAR	ch;
+{
+    return (ch & 0xFF00 ? 2 : 1);
+}
+
+/*
+ * Determine if the current character can be used as a folding point.
+ */
+int	iso2022_fold (ch)
+RCHAR	ch;
+{
+    if (ch < 0x7F && isspace (ch)) {
+    	return (1);
+    } else {
+        return ((ch & 0xFF00) != 0);
+    }
+}
+
+/*
+ * Render the given ISO-2022 character.
+ */
+iso2022_render (ch,param)
+RCHAR	ch;
+void	*param;
+{
+    if (ch & 0xFF00) {
+	if (OutCharLen < 2) {
+	    /* Add extra escape sequences after stray ASCII characters */
+	    /* This normally happens in excerpts and signatures, etc.  */
+	    if (OutAsciiMode == RICH_ENC_JP_ASCII) {
+		(*RichtextPutc) (033,param);
+		(*RichtextPutc) ('$',param);
+		(*RichtextPutc) (SwToOther,param);
+	    } else if (OutAsciiMode == RICH_ENC_KR_ASCII) {
+		(*RichtextPutc) (SO,param);
+	    }
+	}
+        (*RichtextPutc) ((int)((ch & 0xFF00) >> 8),param);
+        (*RichtextPutc) ((int)(ch & 0xFF),param);
+    } else {
+	if (OutCharLen > 1 && ch >= 0x20) {
+	    /* Add extra escape sequences before stray ASCII characters */
+	    /* This normally happens in excerpts and signatures, etc.   */
+	    if (OutAsciiMode == RICH_ENC_JP_ASCII) {
+		(*RichtextPutc) (033,param);
+		(*RichtextPutc) ('(',param);
+		(*RichtextPutc) (SwToAscii,param);
+	    } else if (OutAsciiMode == RICH_ENC_KR_ASCII) {
+		(*RichtextPutc) (SI,param);
+	    }
+	}
+	(*RichtextPutc) ((int)(ch & 0xFF),param);
+    }
+}
+
+/*
+ * Enter or leave the ISO-2022 encoding.
+ */
+iso2022_encoding (newenc)
+int	newenc;
+{
+    switch (newenc) {
+	case RICH_ENC_US_ASCII: controloutput("\033(B",0); break;
+	case RICH_ENC_JP_ASCII: controloutput("\033(J",0); break;
+	case RICH_ENC_KR_ASCII: controloutput("\017",0);   break;
+	case RICH_ENC_JIS_1978: controloutput("\033$@",0); break;
+	case RICH_ENC_JIS_1983: controloutput("\033$B",0); break;
+	case RICH_ENC_KSC_5601: controloutput("\016",0);   break;
+	default:		controloutput("\033(B",0); break;
+    }
+}
+
+/*
+ * Define the ISO-2022-JP and ISO-2022-KR character set processor.
+ */
+struct 	charsetproc	iso2022_charset =
+	  {"iso-2022-jp:iso-2022-kr",
+	   iso2022_init,
+	   iso2022_command,
+	   iso2022_single,
+	   iso2022_width,
+	   iso2022_fold,
+	   iso2022_render,
+	   iso2022_encoding};
+
+/*
+ * Define an output routine for slotting into RichtextPutc so
+ * that ISO-2022 escape sequences are treated correctly.
+ */
+int	iso2022_fputc (ch,file)
+int	ch;
+FILE	*file;
+{
+    if (OutPrevChar == ESC && ch == '(') {
+	/* Process escape sequences that end JIS 2-byte modes */
+	OutCharLen = 1;
+	OutCharSet = OUT_ASCII;
+	OutAsciiMode = RICH_ENC_JP_ASCII;
+    }
+    if (OutPrevPrevChar == ESC && OutPrevChar == '$') {
+	/* Process escape sequences that start JIS 2-byte modes */
+        if (ch != ')') {	/* ')' is for Korean, so ignore it */
+	    OutCharLen = 2;
+	    OutCharSet = OUT_JIS;
+	    OutAsciiMode = RICH_ENC_JP_ASCII;
+	}
+    }
+    if (ch == SO) {
+	OutCharLen = 2;
+	OutCharSet = OUT_KSC;
+	OutAsciiMode = RICH_ENC_KR_ASCII;
+    } else if (ch == SI) {
+	OutCharLen = 1;
+	OutCharSet = OUT_ASCII;
+	OutAsciiMode = RICH_ENC_KR_ASCII;
+    }
+    if (ch == '\n' && OutCharLen == 2) {
+        /* Two-byte characters cannot cross line boundaries */
+	if (OutCharSet == OUT_JIS) {
+            fputc (ESC,file);
+            fputc ('(',file);
+            fputc (SwToAscii,file);
+            fputc ('\n',file);
+            fputc (ESC,file);
+            fputc ('$',file);
+            fputc (SwToOther,file);
+	} else if (OutCharSet == OUT_KSC) {
+	    fputc (SI,file);
+	    fputc ('\n',file);
+	    fputc (SO,file);
+	}
+    } else {
+        fputc (ch,file);
+    }
+    OutPrevPrevChar = OutPrevChar;
+    OutPrevChar = ch;
+}
--- metamail-2.7.orig/src/richmail/Makefile.am
+++ metamail-2.7/src/richmail/Makefile.am
@@ -0,0 +1,15 @@
+MAINTAINERCLEANFILES    = Makefile.in
+
+CFLAGS			= -lncurses
+
+INCLUDES                = -I$(top_builddir) -I$(top_builddir)/metamail \
+                        -I$(top_srcdir) -I$(top_srcdir)/metamail
+
+bin_PROGRAMS            = richtext richtoatk
+
+richtext_SOURCES	= richtext.c richlex.c richset.c usascii.c iso2022.c
+richtext_LDADD		= $(top_builddir)/metamail/libmetamail.la
+
+richtoatk_SOURCES	= richtoatk.c richlex.c richset.c usascii.c iso2022.c
+richtoatk_LDADD		= $(top_builddir)/metamail/libmetamail.la
+
--- metamail-2.7.orig/src/richmail/Makefile.in
+++ metamail-2.7/src/richmail/Makefile.in
@@ -0,0 +1,376 @@
+# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AS = @AS@
+CATCOMMAND = @CATCOMMAND@
+CC = @CC@
+DLLTOOL = @DLLTOOL@
+ECHO = @ECHO@
+EXEEXT = @EXEEXT@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LN_S = @LN_S@
+LPRCOMMAND = @LPRCOMMAND@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_aux_dir = @ac_aux_dir@
+
+MAINTAINERCLEANFILES = Makefile.in
+
+CFLAGS = -lncurses
+
+INCLUDES = -I$(top_builddir) -I$(top_builddir)/metamail                         -I$(top_srcdir) -I$(top_srcdir)/metamail
+
+
+bin_PROGRAMS = richtext richtoatk
+
+richtext_SOURCES = richtext.c richlex.c richset.c usascii.c iso2022.c
+richtext_LDADD = $(top_builddir)/metamail/libmetamail.la
+
+richtoatk_SOURCES = richtoatk.c richlex.c richset.c usascii.c iso2022.c
+richtoatk_LDADD = $(top_builddir)/metamail/libmetamail.la
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = ../../metamail/config.h
+CONFIG_CLEAN_FILES = 
+bin_PROGRAMS =  richtext$(EXEEXT) richtoatk$(EXEEXT)
+PROGRAMS =  $(bin_PROGRAMS)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir) -I../../metamail
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+richtext_OBJECTS =  richtext.$(OBJEXT) richlex.$(OBJEXT) \
+richset.$(OBJEXT) usascii.$(OBJEXT) iso2022.$(OBJEXT)
+richtext_DEPENDENCIES =  $(top_builddir)/metamail/libmetamail.la
+richtext_LDFLAGS = 
+richtoatk_OBJECTS =  richtoatk.$(OBJEXT) richlex.$(OBJEXT) \
+richset.$(OBJEXT) usascii.$(OBJEXT) iso2022.$(OBJEXT)
+richtoatk_DEPENDENCIES =  $(top_builddir)/metamail/libmetamail.la
+richtoatk_LDFLAGS = 
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+DIST_COMMON =  Makefile.am Makefile.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP_ENV = --best
+DEP_FILES =  .deps/iso2022.P .deps/richlex.P .deps/richset.P \
+.deps/richtext.P .deps/richtoatk.P .deps/usascii.P
+SOURCES = $(richtext_SOURCES) $(richtoatk_SOURCES)
+OBJECTS = $(richtext_OBJECTS) $(richtoatk_OBJECTS)
+
+all: all-redirect
+.SUFFIXES:
+.SUFFIXES: .S .c .lo .o .obj .s
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
+	cd $(top_srcdir) && $(AUTOMAKE) --foreign src/richmail/Makefile
+
+Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
+	cd $(top_builddir) \
+	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+mostlyclean-binPROGRAMS:
+
+clean-binPROGRAMS:
+	-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
+distclean-binPROGRAMS:
+
+maintainer-clean-binPROGRAMS:
+
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	$(mkinstalldirs) $(DESTDIR)$(bindir)
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    echo " $(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
+	    $(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+	  else :; fi; \
+	done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+	done
+
+# FIXME: We should only use cygpath when building on Windows,
+# and only if it is available.
+.c.obj:
+	$(COMPILE) -c `cygpath -w $<`
+
+.s.o:
+	$(COMPILE) -c $<
+
+.S.o:
+	$(COMPILE) -c $<
+
+mostlyclean-compile:
+	-rm -f *.o core *.core
+	-rm -f *.$(OBJEXT)
+
+clean-compile:
+
+distclean-compile:
+	-rm -f *.tab.c
+
+maintainer-clean-compile:
+
+.s.lo:
+	$(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+.S.lo:
+	$(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+
+maintainer-clean-libtool:
+
+richtext$(EXEEXT): $(richtext_OBJECTS) $(richtext_DEPENDENCIES)
+	@rm -f richtext$(EXEEXT)
+	$(LINK) $(richtext_LDFLAGS) $(richtext_OBJECTS) $(richtext_LDADD) $(LIBS)
+
+richtoatk$(EXEEXT): $(richtoatk_OBJECTS) $(richtoatk_DEPENDENCIES)
+	@rm -f richtoatk$(EXEEXT)
+	$(LINK) $(richtoatk_LDFLAGS) $(richtoatk_OBJECTS) $(richtoatk_LDADD) $(LIBS)
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS)'; \
+	unique=`for i in $$list; do echo $$i; done | \
+	  awk '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	here=`pwd` && cd $(srcdir) \
+	  && mkid -f$$here/ID $$unique $(LISP)
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)'; \
+	unique=`for i in $$list; do echo $$i; done | \
+	  awk '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+	  || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags  $$unique $(LISP))
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+	-rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = src/richmail
+
+distdir: $(DISTFILES)
+	here=`cd $(top_builddir) && pwd`; \
+	top_distdir=`cd $(top_distdir) && pwd`; \
+	distdir=`cd $(distdir) && pwd`; \
+	cd $(top_srcdir) \
+	  && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign src/richmail/Makefile
+	@for file in $(DISTFILES); do \
+	  d=$(srcdir); \
+	  if test -d $$d/$$file; then \
+	    cp -pr $$d/$$file $(distdir)/$$file; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+	    || cp -p $$d/$$file $(distdir)/$$file || :; \
+	  fi; \
+	done
+
+DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
+
+-include $(DEP_FILES)
+
+mostlyclean-depend:
+
+clean-depend:
+
+distclean-depend:
+	-rm -rf .deps
+
+maintainer-clean-depend:
+
+%.o: %.c
+	@echo '$(COMPILE) -c $<'; \
+	$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+	@-cp .deps/$(*F).pp .deps/$(*F).P; \
+	tr ' ' '\012' < .deps/$(*F).pp \
+	  | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+	    >> .deps/$(*F).P; \
+	rm .deps/$(*F).pp
+
+%.lo: %.c
+	@echo '$(LTCOMPILE) -c $<'; \
+	$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+	@-sed -e 's/^\([^:]*\)\.o[ 	]*:/\1.lo \1.o :/' \
+	  < .deps/$(*F).pp > .deps/$(*F).P; \
+	tr ' ' '\012' < .deps/$(*F).pp \
+	  | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+	    >> .deps/$(*F).P; \
+	rm -f .deps/$(*F).pp
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am: install-binPROGRAMS
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am: uninstall-binPROGRAMS
+uninstall: uninstall-am
+all-am: Makefile $(PROGRAMS)
+all-redirect: all-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs:
+	$(mkinstalldirs)  $(DESTDIR)$(bindir)
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f Makefile $(CONFIG_CLEAN_FILES)
+	-rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+	-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+mostlyclean-am:  mostlyclean-binPROGRAMS mostlyclean-compile \
+		mostlyclean-libtool mostlyclean-tags mostlyclean-depend \
+		mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am:  clean-binPROGRAMS clean-compile clean-libtool clean-tags \
+		clean-depend clean-generic mostlyclean-am
+
+clean: clean-am
+
+distclean-am:  distclean-binPROGRAMS distclean-compile distclean-libtool \
+		distclean-tags distclean-depend distclean-generic \
+		clean-am
+	-rm -f libtool
+
+distclean: distclean-am
+
+maintainer-clean-am:  maintainer-clean-binPROGRAMS \
+		maintainer-clean-compile maintainer-clean-libtool \
+		maintainer-clean-tags maintainer-clean-depend \
+		maintainer-clean-generic distclean-am
+	@echo "This command is intended for maintainers to use;"
+	@echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-am
+
+.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
+maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
+mostlyclean-compile distclean-compile clean-compile \
+maintainer-clean-compile mostlyclean-libtool distclean-libtool \
+clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags distdir \
+mostlyclean-depend distclean-depend clean-depend \
+maintainer-clean-depend info-am info dvi-am dvi check check-am \
+installcheck-am installcheck install-exec-am install-exec \
+install-data-am install-data install-am install uninstall-am uninstall \
+all-redirect all-am all installdirs mostlyclean-generic \
+distclean-generic clean-generic maintainer-clean-generic clean \
+mostlyclean distclean maintainer-clean
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
--- metamail-2.7.orig/src/richmail/richlex.c
+++ metamail-2.7/src/richmail/richlex.c
@@ -0,0 +1,480 @@
+/*-------------------------------------------------------------------------
+
+  richlex.c - Lexical analysis routines for parsing richtext messages.
+ 
+  Copyright (c) 1992 Rhys Weatherley
+
+  Permission to use, copy, modify, and distribute this material
+  for any purpose and without fee is hereby granted, provided
+  that the above copyright notice and this permission notice
+  appear in all copies, and that the name of Rhys Weatherley not be
+  used in advertising or publicity pertaining to this
+  material without specific, prior written permission.
+  RHYS WEATHERLEY MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR
+  SUITABILITY OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED
+  "AS IS", WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+
+  Revision History:
+  ================
+
+   Version  DD/MM/YY  By  Description
+   -------  --------  --  --------------------------------------
+     1.0    31/01/92  RW  Original Version of richlex.c
+     1.1    19/06/92  RW  Add support for multi-byte ISO-2022 codes.
+
+  You may contact the author by:
+  =============================
+
+   e-mail: rhys@cs.uq.oz.au
+     mail: Rhys Weatherley
+	   5 Horizon Drive
+	   Jamboree Heights
+	   Queensland 4074
+	   Australia
+
+  Caveats:
+  =======
+
+  If a multi-byte character contains "<lt>", and a richtext command or
+  escape sequence is started before all bytes of the multi-byte character
+  have been read in, then some characters may be discarded.
+
+-------------------------------------------------------------------------*/
+
+#include <metamail/common.h>
+
+#include "richlex.h"
+#include "richset.h"
+
+int CorrectionEnabled = 1;	/* Zero if correction has been disabled */
+int RichtextLessThanFlag = 0;	/* Non-zero to turn on multi-byte '<' hack */
+
+//extern	int fgetc ();
+//extern	int fputc ();
+
+int (*RichtextGetc) () = fgetc;	/* Function to call to get characters */
+int (*RichtextPutc) () = fputc; /* Function to call to put characters */
+int RichtextCharEncoding = RICH_ENC_US_ASCII; /* Current encoding mode */
+
+#define	MAX_STACK_SIZE	500
+#define	MAX_FLUSH_SIZE	3
+#define	MAX_PUSH_BACK	20
+static	int	StackSize=0;
+static	char	Stack[MAX_STACK_SIZE][MAX_TOKEN_SIZE];
+static	char	NextToken[MAX_TOKEN_SIZE];
+static	int	FlushStack=0;
+static	int	FlushSize=0;
+static	int	EndInpFile=0;
+static	int	CharSize=1;
+static	int	PushbackBuffer[MAX_PUSH_BACK];
+static	int	PushbackSize=0;
+static	int	PushbackExtract=0;
+
+#define	ESC	033
+#define	SI	017
+#define	SO	016
+
+#define	RGETRAW(f)	((*RichtextGetc)(f))
+#define	RGET(f)		(PushbackSize ? richtextgetback() : RGETRAW(f))
+#define	RPUT(c,f)	((*RichtextPutc)(((int)(c)),(f)))
+#define	RUNGET(c)	(richtextunget(c))
+#define	RPUSHBACK(c)	(richtextpushback(c))
+
+/*
+ * Define a "printf" format for a generic ISO-2022 character
+ * set name that includes the hexadecimal representation of
+ * the escape sequence character that turns ISO-2022 on or off
+ * on the terminal.
+ */
+#define	ISO2022_GENERIC	"x-iso-2022-gen-%2x"
+#define	ISO2022_CHARSET "x-iso-charset-"
+
+/*
+ * Define the character set shift characters for ISO-2022-KR.
+ */
+#define	ISO2022_SHIFTIN  "x-iso-shift-in"
+#define	ISO2022_SHIFTOUT "x-iso-shift-out"
+
+/*
+ * Construct multi-byte character codes.
+ */
+#define	RICHCH_2(first,second)	((RCHAR)(((first) << 8) | (second)))
+
+/*
+ * Reset the richtext parsing mechanism.
+ */
+richtextreset()
+{
+    StackSize = 0;
+    FlushStack = 0;
+    FlushSize = 0;
+    EndInpFile = 0;
+    CharSize = 1;
+    PushbackSize = 0;
+    PushbackExtract = 0;
+    RichtextCharEncoding = RICH_ENC_US_ASCII;
+    CorrectionEnabled = 1;
+    RichtextLessThanFlag = 0;
+}
+
+/*
+ * Push a character into the push-back buffer for later
+ * retrieval by RGET.
+ */
+static	void	richtextpushback(c)
+int	c;
+{
+    PushbackBuffer[PushbackSize++] = c;
+}
+
+/*
+ * Unget a character that has been read from the input stream.
+ */
+static	void	richtextunget(c)
+int	c;
+{
+    if (PushbackSize)
+	--PushbackExtract;	/* Character was retrieved from push-back */
+    else
+	richtextpushback(c);	/* Put character into empty push-back */
+}
+
+/*
+ * Unget two characters that have been read from the input stream.
+ */
+static	void	richtextunget2(c1,c2)
+int	c1,c2;
+{
+    if (PushbackExtract > 1) {
+	PushbackExtract -= 2;	/* Go back two characters in the push-back */
+	PushbackBuffer[PushbackExtract++] = c1;
+	PushbackBuffer[PushbackExtract++] = c2;
+    } else {
+	richtextpushback(c1);	/* Put the characters into the push-back */
+	richtextpushback(c2);
+    }
+}
+
+/*
+ * Retrieve a character from the push-back buffer.
+ */
+static	int	richtextgetback()
+{
+    int c;
+    c = PushbackBuffer[PushbackExtract++];
+    if (PushbackExtract >= PushbackSize) {
+	PushbackSize = 0;
+	PushbackExtract = 0;
+    }
+    return(c);
+}
+
+/*
+ * Find a match between NextToken and an element on the stack.
+ * Returns the number of elements down from the top it is.
+ * i.e. 0 if not on the stack, 1 if at the top, etc.
+ */
+static int richtextmatchup()
+{
+    int i = StackSize;
+    while (i > 0 && i > (StackSize - MAX_FLUSH_SIZE)) {
+	--i;
+	if (!strcmp(NextToken,Stack[i]))
+	    return(StackSize - i);
+    }
+    return(0);
+}
+
+/*
+ * Determine if the current token is one of the singleton
+ * richtext commands: <nl>, <lt>, <np>.
+ */
+static richtextsingle(TextEnriched)
+int TextEnriched;
+{
+    return (charsetsingle (NextToken) ||
+	    (!TextEnriched &&
+	        (!strcmp(NextToken,"nl") ||
+		!strcmp(NextToken,"lt") ||
+		!strcmp(NextToken,"np"))));
+}
+
+/*
+ * Recognise a character that can start a richtext command.
+ */
+#define	iscmdch(c)	(isalpha(c) || isdigit(c) || (c) == '/' || (c) == '-')
+#define iscmdch2(c)	(isalpha(c) || isdigit(c) || (c) == '-')
+#define TOLOWER(c)	(isupper(c)?tolower(c):c)
+#define valid_command(c1,c2) \
+	(( c1 == '/' && iscmdch2(c2) ) || \
+	 (!TextEnriched && TOLOWER(c1) == 'l' && TOLOWER(c2) == 't' ))
+
+/*
+ * Get the next token from the input stream.  RICHTEXT_COMMAND
+ * or RICHTEXT_NEG_COMMAND are returned if it is a richtext command.
+ * e.g. "<cmd>" or "</cmd>".  The "token" buffer will receive the
+ * name of the command (without <,> or /) if it is a command.  This
+ * function will also truncate commands longer than MAX_TOKEN_SIZE - 1
+ * characters and abort command parsing if white space is encountered,
+ * so, for example, errors like "<bold hi kids</bold>" don't cause
+ * problems: it will be corrected to "<bold>hi kids</bold>".
+ */
+RCHAR richtextlex(file,token,TextEnriched, nofill)
+void *file;
+char *token;
+int TextEnriched;
+int nofill; /* Inside a nofill env we parse newlines differently */
+{
+    int c,i,lastch;
+    RCHAR cmd;
+
+    lastch = 0;		/* No previous character for multi-byte chars as yet */
+
+    /* Perform any flushing of balancing commands that is necessary */
+    if (FlushStack) {
+	/* Flush out some extra closing commands */
+	strcpy(token,Stack[StackSize - FlushSize + (--FlushStack)]);
+	return(RICHTEXT_NEG_COMMAND);
+    } else if (FlushSize) {
+	/* Finished flushing: output the pending close command */
+	StackSize -= FlushSize;
+	if (StackSize > 0)
+	    --StackSize; /* Remove the command that was being matched up */
+	FlushSize = 0;
+	strcpy(token,NextToken);
+	if (EndInpFile)
+	    return((RCHAR)EOF); /* The last flush was the end-of-file cleanup */
+	else
+	    return(RICHTEXT_NEG_COMMAND);
+    }
+
+    /* Fetch a new character or richtext command */
+    for (;;) {		/* Loop so we can come back on ignored commands */
+        c = RGET(file);
+        if (c == '<') { 
+	    /* Check for multi-byte mode, where "<" is special */
+	    int c2;
+	    if (CharSize > 1) {
+		if (RichtextLessThanFlag) {
+		    /* The multi-byte '<' hack is in effect: not a command */
+		    if (lastch)
+		        return(RICHCH_2(lastch,'<'));
+		    lastch = '<';
+		    continue;	/* Back around for another character */
+		}
+		if ((c = RGET(file)) == EOF) {
+		    RUNGET(c);
+		    return((RCHAR)'<');
+		}
+		c2 = RGET(file);
+		richtextunget2(c,c2);
+		if( !valid_command(c,c2) ){
+		    /* We have a stray less-than symbol */
+	            if (lastch)
+		        return(RICHCH_2(lastch,'<'));
+	            lastch = '<';
+	            continue;	/* Back around for another character */
+		}
+	    } else if (TextEnriched) {
+	    	c2 = RGET(file);
+		if (c2 == '<') {
+		    return((RCHAR)c);
+		} else {
+		    RUNGET(c2);
+		}
+	    }
+
+	    /* Read a command token from the input file */
+	    cmd = RICHTEXT_COMMAND;
+	    if ((c = RGET(file)) == '/') {
+	        cmd = RICHTEXT_NEG_COMMAND;
+	        c = RGET(file);
+	    }
+            for (i = 0; i < (MAX_TOKEN_SIZE - 1) && c != '>'
+	    		&& c != EOF && !isspace(c); ++i) {
+                NextToken[i] = isupper(c) ? tolower(c) : c;
+	        c = RGET(file);
+            }
+	    if (c != '>' && c != EOF && !isspace(c)) {
+		/* We have a long command: skip the rest of it */
+		while (c != '>' && c != EOF && !isspace(c))
+		    c = RGET(file);
+	    }
+            if (c == EOF) {
+		if (!StackSize)
+	    	    return((RCHAR)EOF);
+	        /* Flush the remaining commands at the end of the input file */
+	        FlushSize = StackSize;
+	        FlushStack = FlushSize;
+	        EndInpFile = 1;
+	        return(richtextlex(file,token,TextEnriched, nofill)); /* Flush something out */
+	    }
+            NextToken[i] = '\0';
+
+	    /* Process <lt> specially for multi-byte characters */
+	    if (CharSize > 1 && !TextEnriched && !strcmp(NextToken,"lt")) {
+	        if (lastch)
+		    return(RICHCH_2(lastch,'<'));
+	        lastch = '<';
+	        continue;	/* Back around for another character */
+	    }
+
+	    /* Check to see if we need to correct anything */
+	    if (!CorrectionEnabled) {
+		/* No correction to do: just skip the correction phase */
+		strcpy(token,NextToken);
+		return(cmd);
+	    }
+	    if (cmd == RICHTEXT_COMMAND) {
+		/* Save the command on the stack if not a singleton command */
+		if (!richtextsingle(TextEnriched)) {
+		    strcpy (Stack[StackSize++],NextToken);
+		}
+	    }
+	    else if (!(i = richtextmatchup()))
+		continue;	/* No matchup - just drop it */
+	    else if (i == 1)
+		--StackSize;	/* Correct match at the stack top */
+	    else {
+		/* Flush some correction elements from the stack */
+		FlushSize = i - 1;
+		FlushStack = FlushSize;
+		return(richtextlex(file,token,TextEnriched, nofill));
+	    }
+	    strcpy(token,NextToken);
+	    return(cmd);
+        } else if (c == SI) {
+	    /* Shift-in character: translate to a singleton */
+	    strcpy(token,ISO2022_SHIFTIN);
+	    return(RICHTEXT_COMMAND);
+	} else if (c == SO) {
+	    /* Shift-out character: translate to a singleton */
+	    strcpy(token,ISO2022_SHIFTOUT);
+	    return(RICHTEXT_COMMAND);
+	} else if (c == ESC) {
+	    /* Check for escape sequences that change character sizes */
+	    int newc;
+	    c = RGET(file);
+	    if (c == '$') {
+		newc = RGET(file);
+		if (newc == ')') {
+		    newc = RGET(file);	/* 4-byte ESC-$-)-? sequence */
+		    sprintf(token,ISO2022_CHARSET,newc);
+		} else {
+		    sprintf(token,ISO2022_GENERIC,newc);
+		}
+		return(RICHTEXT_COMMAND);
+	    } else if (c == '(') {
+		newc = RGET(file);
+		sprintf(token,ISO2022_GENERIC,newc);
+		return(RICHTEXT_NEG_COMMAND);
+	    } else {
+		RUNGET(c);
+		return((RCHAR)ESC);
+	    }
+        } else if (c == EOF && StackSize) {
+	    /* Flush the remaining commands at the end of the input file */
+	    FlushSize = StackSize;
+	    FlushStack = FlushSize;
+	    EndInpFile = 1;
+	    return(richtextlex(file,token,TextEnriched, nofill)); /* Flush something out */
+	} else if (CharSize > 1) {
+	    /* Recognise a multi-byte character */
+	    int newc;
+	    if (!lastch && isspace (c))
+	      return ((RCHAR)c); /* Hack for spaces in 2-byte modes */
+	    if (lastch)
+		return (RICHCH_2(lastch,c)); /* This is second of 2 chars */
+	    if ((newc = RGET(file)) == EOF) {
+		RUNGET(newc);	/* Push the EOF back into the input stream */
+		return((RCHAR)c); /* Just return the partial single-byte char */
+	    } else if (newc == '<') {
+		/* The second character could be "<lt>", so loop around */
+		lastch = c;
+		RUNGET(newc);
+		continue;
+	    } else {
+	    	return(RICHCH_2(c,newc));
+	    }
+	} else if (TextEnriched && !nofill && (c == '\n')) {
+	    int c2 = RGET(file);
+	    RUNGET(c2);
+	    if (c2 == '\n') {
+		strcpy(token, "iNtErNaL-nL");
+		return(RICHTEXT_COMMAND);
+	    } else {
+		return((RCHAR)c);
+	    }
+	} else {
+	    return((RCHAR)c);
+	}
+    }
+}
+
+/*
+ * Output a string via "RichtextPutc".
+ */
+static richtextoutstr(str,outparam)
+char *str;
+void *outparam;
+{
+    while (*str) {
+	RPUT(*str,outparam);
+	++str;
+    }
+}
+
+/*
+ * Read the input stream, correct the richtext, and write the
+ * results to the output stream.
+ */
+richtextcorrect(inparam,outparam,TextEnriched)
+void *inparam,*outparam;
+int TextEnriched;
+{
+    RCHAR c;
+    char token[MAX_TOKEN_SIZE];
+    while ((c = richtextlex(inparam,token,TextEnriched, 0)) != (RCHAR)EOF) {
+	if (c == RICHTEXT_COMMAND) {
+	    RPUT('<',outparam);
+	    richtextoutstr(token,outparam);
+	    RPUT('>',outparam);
+	} else if (c == RICHTEXT_NEG_COMMAND) {
+	    RPUT('<',outparam);
+	    RPUT('/',outparam);
+	    richtextoutstr(token,outparam);
+	    RPUT('>',outparam);
+	} else if (c >= 256) {
+	    RPUT(RICHCH2_FIRST(c),outparam);
+	    RPUT(RICHCH2_SECOND(c),outparam);
+	} else {
+	    RPUT(c,outparam);
+	}
+    }
+}
+
+/*
+ * Change the encoding used for characters not present in
+ * richtext command sequences.
+ */
+richtextencoding(encoding)
+int	encoding;
+{
+    RichtextCharEncoding = encoding;
+    switch (RichtextCharEncoding) {
+	case RICH_ENC_US_ASCII:
+	case RICH_ENC_JP_ASCII:
+	case RICH_ENC_KR_ASCII:
+		CharSize = 1;
+		break;
+
+	case RICH_ENC_JIS_1978:
+	case RICH_ENC_JIS_1983:
+	case RICH_ENC_KSC_5601:
+		CharSize = 2;
+		break;
+
+	default:CharSize = 1;
+		break;
+    }
+}
--- metamail-2.7.orig/src/richmail/richlex.h
+++ metamail-2.7/src/richmail/richlex.h
@@ -0,0 +1,166 @@
+/*-------------------------------------------------------------------------
+
+  richlex.h - Lexical analysis routines for parsing richtext messages.
+ 
+  Copyright (c) 1992 Rhys Weatherley
+
+  Permission to use, copy, modify, and distribute this material
+  for any purpose and without fee is hereby granted, provided
+  that the above copyright notice and this permission notice
+  appear in all copies, and that the name of Rhys Weatherley not be
+  used in advertising or publicity pertaining to this
+  material without specific, prior written permission.
+  RHYS WEATHERLEY MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR
+  SUITABILITY OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED
+  "AS IS", WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+
+  Revision History:
+  ================
+
+   Version  DD/MM/YY  By  Description
+   -------  --------  --  --------------------------------------
+     1.0    31/01/92  RW  Original Version of richlex.h
+     1.1    19/06/92  RW  Add support for multi-byte ISO-2022 codes.
+
+  You may contact the author by:
+  =============================
+
+   e-mail: rhys@cs.uq.oz.au
+     mail: Rhys Weatherley
+	   5 Horizon Drive
+	   Jamboree Heights
+	   Queensland 4074
+	   Australia
+
+-------------------------------------------------------------------------*/
+
+#ifndef	__RICHTEXT_H__
+#define	__RICHTEXT_H__
+
+#include <metamail/common.h>
+
+BEGIN_C_DECLS
+
+//#ifdef	__cplusplus
+//extern "C" {
+//#endif
+
+/*
+ * Define the data type to be used by characters in the richtext
+ * system.  Note: this is a long because some machines, MS-DOS
+ * machines for example, only have 16-bit integers and hence won't
+ * be able to cope with large multi-byte character codes.  If
+ * something is strange with your character processing, it is
+ * probably because you aren't using the right types.
+ */
+typedef	long	RCHAR;
+
+/*
+ * Set the following variable to zero to disable the
+ * correction of richtext commands.  The default
+ * value is non-zero.
+ */
+extern	int CorrectionEnabled;
+
+/*
+ * Set the following value to non-zero to enable the
+ * multi-byte '<' hack which ignores richtext commands
+ * in multi-byte modes.  The default value is zero.
+ */
+extern	int RichtextLessThanFlag;
+
+/*
+ * Define the function to call to get characters from
+ * the message.  The calling convention of this
+ * function is: "int func (void *param)".  The default
+ * value is "fgetc".  The function must return EOF
+ * at the end of the messsage;
+ */
+extern	int (*RichtextGetc) ();
+
+/*
+ * Define the function to call to output characters from
+ * richtextcorrect.  The calling convention of this
+ * function is: "int func (int c,void *param)".  The default
+ * value is "fputc".
+ */
+extern	int (*RichtextPutc) ();
+
+/*
+ * Define the maximum size of richtext command tokens.
+ */
+#define	MAX_TOKEN_SIZE		50
+
+/*
+ * Define the special token values that are returned by
+ * the "richtextlex" function.  These values were chosen
+ * to keep away from legal ASCII.
+ *
+ * Version 1.1: modified to negative values to keep away
+ * from legal ISO-2022 and other multi-byte characters.
+ */
+#define	RICHTEXT_COMMAND	((RCHAR)(-2))
+#define	RICHTEXT_NEG_COMMAND	((RCHAR)(-3))
+
+/*
+ * Reset the richtext parsing mechanism.
+ */
+extern	richtextreset();
+
+/*
+ * Get the next token from the input stream.  RICHTEXT_COMMAND
+ * or RICHTEXT_NEG_COMMAND are returned if it is a richtext command.
+ * e.g. "<cmd>" or "</cmd>".  The "token" buffer will receive the
+ * name of the command (without <,> or /) if it is a command.  This
+ * function will also truncate commands longer than MAX_TOKEN_SIZE - 1
+ * characters and abort command parsing if white space is encountered,
+ * so, for example, errors like "<bold hi kids</bold>" don't cause
+ * problems: it will be corrected to "<bold>hi kids</bold>".
+ * The "file" parameter is passed to the function pointed to by
+ * "RichtextGetc" on each call.
+ */
+extern	RCHAR	richtextlex( /* void *file,char *token,int TextEnriched */ );
+
+/*
+ * Read the input stream, correct the richtext, and write the
+ * results to the output stream.  "outparam" is passed to the
+ * "RichtextPutc" function as the second argument, and "inparam"
+ * is passed to "richtextlex" during parsing.
+ */
+extern	richtextcorrect( /* void *inparam,void *outparam,int TextEnriched */ );
+
+#define	RICH_ENC_US_ASCII	0	/* US-ASCII encoding: one-byte */
+#define	RICH_ENC_JP_ASCII	1	/* JP-ASCII encoding: one-byte */
+#define	RICH_ENC_KR_ASCII	2	/* KR-ASCII encoding: one-byte */
+#define	RICH_ENC_JIS_1978	100	/* JIS-X-0208-1978: two-byte */
+#define	RICH_ENC_JIS_1983	101	/* JIS-X-0208-1983: two-byte */
+#define	RICH_ENC_KSC_5601	200	/* KSC-5601 (Korean): two-byte */
+
+/*
+ * The following variable contains the current character
+ * encoding in use.  This should only be read.  Setting it
+ * is done via "richtextencoding".
+ */
+extern	int	RichtextCharEncoding;
+
+/*
+ * Change the encoding used for characters not present in
+ * richtext command sequences.
+ */
+extern	richtextencoding( /* int encoding */ );
+
+/*
+ * Define a number of macros for decoding multi-byte character
+ * codes.  The names of the macros have the form "RICHCHn_xxx"
+ * where "n" is the number of bytes in the character.
+ */
+#define	RICHCH2_FIRST(c)	(((c) >> 8) & 0xFF)
+#define	RICHCH2_SECOND(c)	((c) & 0xFF)
+
+//#ifdef	__cplusplus
+//};
+//#endif
+
+END_C_DECLS
+
+#endif	/* __RICHTEXT_H__ */
--- metamail-2.7.orig/src/richmail/richtext.c
+++ metamail-2.7/src/richmail/richtext.c
@@ -0,0 +1,905 @@
+/*
+Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
+
+Permission to use, copy, modify, and distribute this material 
+for any purpose and without fee is hereby granted, provided 
+that the above copyright notice and this permission notice 
+appear in all copies, and that the name of Bellcore not be 
+used in advertising or publicity pertaining to this 
+material without the specific, prior written permission 
+of an authorized representative of Bellcore.  BELLCORE 
+MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
+OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
+WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+*/
+
+#include <metamail/common.h>
+
+#include <curses.h>  /* This and next for tgetstr(3X) and kin */
+#include <term.h>
+
+#include "richlex.h"
+#include "richset.h"
+
+int iso2022_fputc ();
+
+/*
+ * ########################################################################
+ * The function "InitGlobals" must be updated whenever a new variable is
+ * added here or a default value is changed.  The same must be done for
+ * the next section of variables also.  This is needed because this module
+ * could be linked into another program as a library and called more than
+ * once in a single program execution.
+ * ########################################################################
+ */
+static int linepos = 0, inspace = 0, leftmargin = 0, rightmargin, biggertext=0;
+static int workingleft = 0, workingright, inexcerpt = 0, insignature = 0;
+static int highlight=0, underline=0, bold=0, nofill=0;
+static int termcolumns=80, termrows=23;
+int controlputc();
+
+/* A common problem, in justifying text, is figuring out how to format a 
+   line when part of it wants to be left-justified, part right-justified, 
+   and part centered, or some combination thereof.  There is no perfect 
+   solution to this problem, so this program takes an incredibly cheesy 
+   but simple way out:  voting.  For each character on the line, a point
+   is added to the "center" score if it is supposed to be centered, and 
+   so on.  If it is inside TWO "center" environments, two points are added.
+   This may be the world's first implementation of justification by voting...
+*/
+
+static int centerenv=0, leftjustenv=0, rightjustenv=0;
+static int centerct=0, leftjustct=0, rightjustct=0;
+static int UsePager = 0;
+static int linesused = 0;
+static int JustSawCmd=0;
+static int JustCorrect = 0;	/* Non-zero to just correct and not format */
+static int OverStrike = 0;
+static int TextEnriched = 0;
+static char MoveRight[10];
+static char highlightbuf[50], highlightendbuf[50], StartUnderline[50], StopUnderline[50];
+static char KS[50], KE[50], BoldOn[50], BoldOff[50];
+static char charsetname[50];
+static int FakeTerminal;
+
+extern tputs();
+
+static outputc(), realoutputc(), MakeWorkingMargins(), Pause(), fputsmovingright(), ResetTerminalCodes(), FinalizeTerminal(), outputstr(), FPUTS(), lc2strcmp();
+
+#define	OUTC(c)		(outputc((RCHAR)(c)))
+
+static void
+InitGlobals()
+{
+    linepos = 0;
+    inspace = 0;
+    leftmargin = 0;
+    biggertext = 0;
+    workingleft = 0;
+    inexcerpt = 0;
+    insignature = 0;
+    termcolumns = 80;
+    termrows = 23;
+    centerenv = 0;
+    leftjustenv = 0;
+    rightjustenv = 0;
+    centerct = 0;
+    leftjustct = 0;
+    rightjustct = 0;
+    UsePager = 0;
+    linesused = 0;
+    JustSawCmd = 0;
+    JustCorrect = 0;
+    highlight = 0;
+    underline = 0;
+    bold = 0;
+    TextEnriched = 0;
+    nofill = 0;
+}
+
+static void
+cleanup(signum)
+int signum;
+{
+    FinalizeTerminal();
+    signal(signum, SIG_DFL);
+    kill(getpid(), signum);
+}
+
+static InitSignals() {
+    signal(SIGINT, cleanup);
+    signal(SIGILL, cleanup);
+    signal(SIGTRAP, cleanup);
+    signal(SIGIOT, cleanup);
+    signal(SIGFPE, cleanup);
+#ifndef linux
+    signal(SIGEMT, cleanup);
+    signal(SIGBUS, cleanup);
+#endif
+    signal(SIGSEGV, cleanup);
+    signal(SIGTERM, cleanup);
+#ifdef SIGXCPU
+    signal(SIGXCPU, cleanup);
+#endif
+}
+
+static nomemabort() {
+    fprintf(stderr, "richtext: Out of memory\n");
+    FinalizeTerminal();
+    exit(-1);
+}
+
+#ifndef	RICHTEXT_LIBRARY
+
+/*
+ * Only include the main function if this module is not being used as a
+ * library call.
+ */
+
+main(argc, argv)
+int argc;
+char **argv;
+{
+  exit(richtext_main(argc, argv));
+}
+
+#endif
+
+richtext_main(argc, argv)
+int argc;
+char **argv;
+{
+    RCHAR c;
+    int i, atstart, negated,
+    ForceTermcap=0, ForcePlain=0, NotTtyEnv = 0;
+    char token[MAX_TOKEN_SIZE], *tok, *nottty;
+    char tbuf[1024], *term, *dum;
+    FILE *InputFP = stdin, *tmpfp;
+
+    InitSignals();
+    InitGlobals();
+    richtextreset();
+    strcpy(charsetname,"us-ascii");
+    dum = (char *) getenv("MM_USEPAGER");
+    if (dum && atoi(dum)) ++UsePager;
+    for (i=1; i< argc; ++i) {
+        if (!strcmp(argv[i], "-p")) {
+            ++UsePager;
+        } else if (!strcmp(argv[i],"-c")) {
+            /* Only perform correction: don't format */
+            JustCorrect = 1;
+        } else if (!strcmp(argv[i], "-f")) {
+            /* Force termcap usage */
+            ForceTermcap = 1;
+        } else if (!strcmp(argv[i], "-t")) {
+            /* Force plain text */
+            ForcePlain = 1;
+        } else if (!strcmp(argv[i],"-n")) {
+            /* Disable the richtext correction routines */
+            CorrectionEnabled = 0;
+        } else if (!strcmp(argv[i],"-m")) {
+            /* Enable the multi-byte '<' hack */
+            RichtextLessThanFlag = 1;
+	} else if (!strncmp(argv[i], "-s", 2)) {
+	    /* Specify the character set to use (and convert to lower case) */
+	    char *name;
+	    if (argv[i][2])
+		strcpy(charsetname, argv[i] + 2);
+	    else if (i < (argc - 1))
+		strcpy(charsetname, argv[++i]);
+	    name = charsetname;
+	    while (*name) {
+		if (isupper(*name))
+		    *name = tolower(*name);
+		++name;
+	    }
+	} else if (!strcmp(argv[i], "-o")) {
+	    /* Use Overstriking */
+	    OverStrike = 1;
+	    ForcePlain = 1;
+	} else if (!strcmp(argv[i], "-e")) {
+		/* Work with text/enriched instead of text/richtext */
+		TextEnriched = 1;
+        } else {
+            /* open for input */
+            tmpfp = fopen(argv[i], "r");
+            if (tmpfp)
+	    	InputFP = tmpfp;
+	    else {
+	    	perror (argv[i]);
+		exit (1);
+	    }
+        }
+    }
+    /* THIS IS THE UNIX TERMINAL INITIALIZATION CODE */
+    nottty = (char *) getenv("MM_NOTTTY");
+    if (nottty) NotTtyEnv = atoi(nottty);
+    if (UsePager && (!isatty(0) || !isatty(1) || NotTtyEnv)) {
+        UsePager = 0;   /* Disable pager if I/O has been redirected or we're under a window-oriented mail reader */
+    }
+    if ((!ForcePlain && (isatty(1) || isatty(0))) || ForceTermcap) {
+        term = (char *) getenv("TERM");
+    } else {
+        term = NULL;
+    }
+    if (term && tgetent(tbuf, term) != 1) {
+        term = NULL;
+    }
+    if (term) {
+        static char cb[1024];
+        char *cp;
+                   
+        cp = cb;
+	
+        if (dum = (char*) tgetstr("ks", &cp)) 
+	  strcpy (KS, dum); 
+	else
+	  KS[0] = '\0';
+        if (dum = (char*) tgetstr("ke", &cp)) 
+	  strcpy (KE, dum); 
+	else
+	  KE[0] = '\0';
+        if (dum = (char*) tgetstr("so", &cp))
+	  strcpy (highlightbuf, dum); highlightbuf[0] = '\0';
+        if (dum = (char*) tgetstr("se", &cp))
+	  strcpy (highlightendbuf, dum); highlightendbuf[0] = '\0';
+        if (dum = (char*) tgetstr("md", &cp)) 
+	  strcpy (BoldOn, dum); 
+	else 
+	  strcpy(BoldOn, highlightbuf);
+        if (dum = (char*) tgetstr("me", &cp)) 
+	  strcpy (BoldOff, dum); 
+	else 
+	  strcpy(BoldOff, highlightendbuf);
+        if (dum = (char*) tgetstr("us", &cp))
+	  strcpy (StartUnderline, dum);
+	else
+	  StartUnderline[0] = '\0';
+        if (dum = (char*) tgetstr("ue", &cp))
+	  strcpy (StopUnderline, dum);
+	else StopUnderline[0] = '\0';
+        if (dum = (char*) tgetstr("nd", &cp))
+	  strcpy (MoveRight, dum);
+	else {
+            MoveRight[0] = ' ';
+            MoveRight[1] = '\0';
+        }
+        /* Some TERMCAP entries have REALLY screwed up "nd" fields, sigh... */
+        if (!strcmp(MoveRight, "\014")) strcpy(MoveRight, " ");
+        termcolumns = tgetnum("co");
+        if (termcolumns <= 0) termcolumns = 80;
+        termrows = tgetnum("li");
+        if (termrows <= 0) termrows = 23;
+	else termrows--;
+        FakeTerminal=0;
+    } else if (OverStrike) {
+        KS[0] = '\0';
+        KE[0] = '\0';
+	FakeTerminal = 1;
+	BoldOn[0] = '\0';
+	BoldOff[0] = '\0';
+	highlightbuf[0] = '\0';
+	highlightendbuf[0] = '\0';
+	StartUnderline[0] = '\0';
+	StopUnderline[0] = '\0';
+	strcpy(MoveRight, " ");
+        termcolumns = 80;
+        termrows = 23;
+    } else {
+        KS[0] = '\0';
+        KE[0] = '\0';
+        FakeTerminal = 1;
+        strcpy(BoldOn, "*");
+        strcpy(BoldOff, "*");
+        strcpy(highlightbuf, "_");
+        strcpy(highlightendbuf, "_");
+        strcpy(StartUnderline, "_");
+        strcpy(StopUnderline, "_");
+        strcpy(MoveRight, " ");
+        termcolumns = 80;
+        termrows = 23;
+    }
+    /* Check for the LINES & COLUMNS hack */
+    dum = getenv("LINES");
+    if (dum && ((i=atoi(dum)) > 0)) termrows = i - 1;
+    dum = getenv("COLUMNS");
+    if (dum && ((i=atoi(dum)) > 0)) termcolumns = i;
+    charsetnameinit(charsetname);
+    RichtextPutc = iso2022_fputc;
+    if (JustCorrect) {
+        richtextcorrect(InputFP,stdout,TextEnriched);
+        return(0);
+    }
+    FPUTS(KS, stdout);
+    rightmargin = workingright = termcolumns - 1;
+    while((c = richtextlex(InputFP,token,TextEnriched, nofill)) != (RCHAR)EOF) {
+        if (c == RICHTEXT_COMMAND || c == RICHTEXT_NEG_COMMAND) { 
+            negated = (c == RICHTEXT_NEG_COMMAND);
+            tok = token;
+
+	    /* Try to process the command with the character set processors */
+	    if (charsetcommand (tok,negated))
+	        continue;
+
+	    /* Do the default action for the command */
+            switch(tok[0]) {
+                case 'b':
+                    if (!strcmp(tok, "bold")) {
+                        if (negated) {
+                            --bold;
+                            if (bold <= 0) {
+				if (FakeTerminal) outputstr(BoldOff);
+				else controloutput(BoldOff, 0);
+			    }
+                        } else {
+                            ++bold;
+                        }
+                        ResetTerminalCodes(FakeTerminal, highlight, underline,
+                                            bold, highlightbuf, highlightendbuf, 0,
+                                            StartUnderline, StopUnderline, 0, BoldOn,
+                                            BoldOff, 1);
+                    } else if (!strcmp(tok, "bigger")) {
+                        if (negated) --biggertext; else ++biggertext;
+                    }
+                    break;
+                case 'c':
+                    if (!strcmp(tok, "center")) {
+                        if (negated) --centerenv; else ++centerenv;
+                    } else if (!TextEnriched && !strcmp(tok, "comment")) {
+                        int commct=1;
+			int tempc;
+                        while (commct > 0) {
+                            while ((tempc = getc(InputFP)) != '<' 
+                                    && tempc != EOF) ;
+                            if (tempc == EOF) break;
+                            for (i=0; (tempc = getc(InputFP)) != '>' 
+                              && tempc != EOF; ++i) {
+                                token[i] = isupper(tempc) ? 
+                                  tolower(tempc) : tempc;
+				if (i == MAX_TOKEN_SIZE-2) break;
+                            }
+                            if (tempc== EOF) break;
+                            token[i] = 0;
+                            if (!strcmp(token, "/comment")) --commct;
+                            if (!strcmp(token, "comment")) ++commct;
+                        }
+                    }
+                    break;
+                case 'e':
+                    if (!strcmp(tok, "excerpt")) {
+                        atstart = !(linepos > workingleft);
+                        if (negated) {
+                            leftmargin -= 4;
+                            rightmargin += 4;
+                            --inexcerpt;
+                        } else {
+                            leftmargin += 4;
+                            rightmargin -= 4;
+                            ++inexcerpt;
+                        }
+                        MakeWorkingMargins();
+                        if (!atstart) OUTC('\n');
+                    }
+                    break;
+                case 'f':
+                    if (!strcmp(tok, "flushleft")) {
+                        if (negated) --leftjustenv; else ++leftjustenv;
+                    } else if (!strcmp(tok, "flushright")) {
+                        if (negated) --rightjustenv; else ++rightjustenv;
+                    }
+                    break;
+                case 'i':
+                    if (!strcmp(tok, "italic")) {
+                        if (negated) {
+                            --highlight;
+                            if (highlight <= 0) {
+				if (FakeTerminal) outputstr(highlightendbuf);
+				else controloutput(highlightendbuf, 0);
+			    }
+                        } else {
+                            ++highlight;
+                        }
+                        ResetTerminalCodes(FakeTerminal, highlight, underline, bold,
+                                            highlightbuf, highlightendbuf, 1, StartUnderline,
+                                            StopUnderline, 0, BoldOn, BoldOff, 0);
+                    } else if (!strcmp(tok, "indent")) {
+                        if (negated) {
+                            leftmargin -= 4;
+                        } else {
+                            leftmargin += 4;
+                        }
+                    } else if (!strcmp(tok, "indentright")) {
+                        if (negated) {
+                            rightmargin += 4;
+                        } else {
+                            rightmargin -= 4;
+                        }
+		    } else if (TextEnriched && !strcmp(tok, "iNtErNaL-nL")) {
+			OUTC('\n');
+                    }
+                    MakeWorkingMargins();
+                    break;
+                case 'l':
+                    if (!TextEnriched && !strcmp(tok, "lt")) {
+                        OUTC('<');
+                    }
+                    break;
+                case 'n':
+ 		    if (!TextEnriched && !strcmp(tok, "nl")) {
+                        OUTC('\n');
+		    } else if (TextEnriched && !strcmp(tok, "nofill")) {
+			if (negated) {
+			    --nofill;
+			} else {
+			    ++nofill;
+			}
+                    } else if (!TextEnriched && !strcmp(tok, "np")) {
+                        OUTC('\n');
+                        OUTC('\014');
+                    }
+                    break;
+                case 'o':
+                    if (!TextEnriched && !strcmp(tok, "outdent")) {
+                        if (negated) {
+                            leftmargin += 4;
+                        } else {
+                            leftmargin -= 4;
+                        }
+                    } else if (!TextEnriched && !strcmp(tok, "outdentright")) {
+                        if (negated) {
+                            rightmargin -= 4;
+                        } else {
+                            rightmargin += 4;
+                        }
+                    }
+                    MakeWorkingMargins();
+                    break;                    
+                case 'p':
+                    if (!TextEnriched && !strcmp(tok, "paragraph")) {
+                        if (negated) OUTC('\n');
+                        OUTC('\n');
+                    } else if (TextEnriched && !strcmp(tok, "param")) {
+                        int commct=1;
+                        while (commct > 0) {
+			    for (;;) {
+				c = richtextlex(InputFP,token,TextEnriched, nofill);
+				if (c == EOF || c == RICHTEXT_COMMAND || c == RICHTEXT_NEG_COMMAND)
+				    break;
+                            }
+			    if (c == EOF) break;
+			    if (!strcmp(token,"param")) {
+				if (c == RICHTEXT_NEG_COMMAND) --commct;
+				else if (c == RICHTEXT_COMMAND) ++commct;
+                        }
+                    }
+		    }
+                    break;
+                case 's':
+                    if (!TextEnriched && !strcmp(tok, "signature")) {
+                        atstart = !(linepos > workingleft);
+                        if (negated) {
+                            leftmargin -= 4;
+                            rightmargin += 4;
+                            --insignature;
+                        } else {
+                            leftmargin += 4;
+                            rightmargin -= 4;
+                            ++insignature;
+                        }
+                        MakeWorkingMargins();
+                        if (!atstart) OUTC('\n');
+                    }
+                    break;
+                case 'u':
+                    if (!strcmp(tok, "underline")) {
+                        if (negated) {
+                            --underline;
+                            if (underline <= 0) {
+				if (FakeTerminal) outputstr(StopUnderline);
+				else controloutput(StopUnderline,0);
+			    }
+                        } else {
+                            ++underline;
+                        }
+                        ResetTerminalCodes(FakeTerminal, highlight, underline, bold,
+                                            highlightbuf, highlightendbuf, 0, StartUnderline,
+                                            StopUnderline, 1, BoldOn, BoldOff, 0);
+                    }
+                    break;
+                case 'v':
+                    if (TextEnriched && !strcmp(tok, "verbatim")) {
+                        for (;;) {
+			    int tempc;
+                            while ((tempc = getc(InputFP)) != '<' 
+                                    && tempc != EOF)
+				OUTC(tempc);
+                            if (tempc == EOF) break;
+			    ungetc(tempc = getc(InputFP), InputFP);
+			    if (tempc == '<') {
+				OUTC('<');
+				getc(InputFP);
+				continue;
+			    }
+                            for (i=0; (tempc = getc(InputFP)) != '>' 
+                              && tempc != EOF; ++i) {
+                                token[i] = tempc;
+				if (i == MAX_TOKEN_SIZE-2) break;
+                            }
+                            if (tempc== EOF) break;
+                            token[i] = 0;
+                            if (!lc2strcmp(token, "/verbatim")) break;
+			    else for (i=0; token[i]; i++)
+			        OUTC(token[i]);
+                        }
+                    }
+                    break;
+                default:
+                    /* Ignore all other tokens */
+                    break;
+            }
+            JustSawCmd = 1;
+        } else if (c == '\n') {
+	    if (nofill) {
+		OUTC(c);
+	    } else if (linepos > 0 && !inspace) {
+                OUTC(' ');
+            }
+            JustSawCmd = 0;
+        } else {
+            OUTC(c);
+            JustSawCmd = 0;
+        }
+    }
+    if (term) { /* cleanup a bit for insurance */
+        controloutput(highlightendbuf, 0);
+        controloutput(StopUnderline, 0);
+    }
+    OUTC('\n'); /* for good measure */
+    FPUTS(KE, stdout);
+    fflush(stdout);
+    if (UsePager) {
+        Pause();
+    }
+    return(0);
+}
+
+static struct charsetmember OutputBuf[1000] = {0,0};
+static int PendingOutput = 0, PendingControls = 0;
+
+controlputc(c)
+int c;
+{
+    charmemberctrl (&OutputBuf[PendingOutput],(RCHAR)c);
+    ++PendingOutput;
+    ++PendingControls;
+}
+
+static immediate_controlputc(c)
+int c;
+{
+    (*RichtextPutc) (c, stdout);
+}
+
+controloutput(s, immediate)
+char *s;
+int immediate;
+{
+    tputs(s, 1, immediate ? immediate_controlputc : controlputc);
+}
+
+static folding_point (buf, pos)
+struct	charsetmember *buf;
+int	pos;
+{
+    int i;
+    for (i = pos; i > 0; --i) {
+    	if (!charisctrl (buf[i]) && charmemberfold (buf[i]))
+	    return (i);
+    }
+    return (0);
+}
+
+static calc_column (buf, pos)
+struct	charsetmember *buf;
+int	pos;
+{
+    struct charsetmember *s;
+    int col = 0;
+    for (s = buf; (s -> ch); ++s) {
+    	if (!charisctrl (*s))
+    	    col += charmemberwidth (*s);
+	else
+	    ++col;
+    }
+    return (col);
+}
+
+static FlushOut() {
+    int i, j, x;
+    static struct charsetmember NewOutputBuf[1000];
+    struct charsetmember *s;
+    int NewPendingControls=0, NewPendingOutput = 0;
+
+    OutputBuf[PendingOutput].ch = 0;
+    OutputBuf[PendingOutput].charset = NULL;
+    if (linepos >= workingright) {
+        for (i=0, j=0; j<workingright && i < PendingOutput; ++i) {
+            if (!charisctrl (OutputBuf[i])) ++j;
+        }
+	x = folding_point (OutputBuf,i);
+	if ((workingleft + 4) < x)
+	    i = x;
+	else
+            while (i > workingleft + 4) {
+                if (!charisctrl (OutputBuf[i])
+                     && isspace((unsigned char) OutputBuf[i].ch)) {
+                    break;
+                }
+                --i;
+            }
+        for (j=0; i<PendingOutput; ++j, ++i) {
+            NewOutputBuf[j] = OutputBuf[i];
+            ++NewPendingOutput;
+            if (charisctrl (NewOutputBuf[j])) ++NewPendingControls;
+        }
+        PendingOutput -= NewPendingOutput;
+        PendingControls -= NewPendingControls;
+        charmember (&OutputBuf[PendingOutput],(RCHAR)'\n');
+	PendingOutput++;
+        OutputBuf[PendingOutput].ch = 0;
+        OutputBuf[PendingOutput].charset = 0;
+#ifdef MISTAKE
+        ResetTerminalCodes(FakeTerminal, highlight, underline, bold,
+                            highlightbuf, highlightendbuf, 0, StartUnderline,
+                            StopUnderline, 0, BoldOn, BoldOff, 0);
+#endif
+    }
+    if ((rightjustct > leftjustct)
+         && (rightjustct > centerct)
+         && (rightjustct > 0)) {
+        /* right justified */
+        i = rightmargin - calc_column (OutputBuf,PendingOutput) 
+		+ PendingControls;
+        for (j=0; j<i; ++j)  {
+            controloutput(MoveRight, 1);
+        }
+        fputsmovingright(OutputBuf, stdout);
+        ++linesused;
+    } else if ((leftjustct > centerct)
+                && (leftjustct > 0)) {
+        /* left justified */
+        for (s=OutputBuf; s -> ch && isspace((unsigned char) (s -> ch)); ++s)
+	    {;}
+        fputsmovingright(s, stdout);
+        ++linesused;
+    } else if (centerct > 0) {
+        /* centered */
+        i = (termcolumns - calc_column (OutputBuf,PendingOutput) - 1
+		+ PendingControls) / 2;
+        for (j=0; j<i; ++j) {
+            controloutput(MoveRight, 1);
+        }
+        fputsmovingright(OutputBuf, stdout);
+        ++linesused;
+    } else {
+        /* Leave indentation (margins) as-is */
+        fputsmovingright(OutputBuf, stdout);
+        ++linesused;
+    }
+    if (linesused >= termrows && UsePager) Pause();
+    rightjustct = leftjustct = centerct = 0; /* not quite right for wrapping, sigh... */
+    PendingOutput = PendingControls = linepos = 0;
+    inspace = 1;
+    j = (isspace((unsigned char) NewOutputBuf[0].ch)) ? 1 : 0;
+    for ( ; j<NewPendingOutput; ++j) {
+        if (charisctrl (NewOutputBuf[j])) {
+	    OutputBuf[PendingOutput++] = NewOutputBuf[j];
+            ++PendingControls;
+        } else {
+            realoutputc(NewOutputBuf[j], 1);
+        }
+    }
+    ResetTerminalCodes(FakeTerminal, highlight, underline, bold,
+                        highlightbuf, highlightendbuf, 0, StartUnderline,
+                        StopUnderline, 0, BoldOn, BoldOff, 0);
+}
+
+static outputc(c)
+RCHAR c;
+{
+    struct charsetmember member;
+    charmember (&member,c);
+    realoutputc(member, 0);
+}
+
+static realoutputc(c, alreadyformatted)
+struct charsetmember c;
+int alreadyformatted;
+{
+    int i, newinspace;
+
+    if (c.ch == '\n') {
+    	charmember (&OutputBuf[PendingOutput],(RCHAR)'\n');
+	PendingOutput++;
+        FlushOut();
+    } else if (c.ch == '\t') {
+        int tabpos = (linepos + 8) / 8;
+        if (tabpos >= workingright) {
+    	    charmember (&OutputBuf[PendingOutput],(RCHAR)'\n');
+	    PendingOutput++;
+            FlushOut();
+        } else {
+            int spaces = (8*tabpos) - linepos;
+            while (spaces-->0) {
+    	        charmember (&OutputBuf[PendingOutput],(RCHAR)' ');
+	        PendingOutput++;
+                ++linepos;
+            }
+        }
+    } else {
+        newinspace = isspace((unsigned char) c.ch);
+        if (!inspace || !newinspace || !JustSawCmd) {
+            if (linepos == 0) {
+                int i = workingleft;
+                if (inexcerpt) {
+    	            charmember (&OutputBuf[PendingOutput],(RCHAR)'>');
+	            PendingOutput++;
+                    --i;
+                }
+                if (insignature) {
+    	            charmember (&OutputBuf[PendingOutput],(RCHAR)'+');
+	            PendingOutput++;
+                    --i;
+                }
+                while (i-->0) {
+    	            charmember (&OutputBuf[PendingOutput],(RCHAR)' ');
+	            PendingOutput++;
+                }
+                linepos = workingleft;
+            }
+            if (!alreadyformatted && biggertext && !(inspace && newinspace)) {
+    	        charmember (&OutputBuf[PendingOutput],(RCHAR)'_');
+	        PendingOutput++;
+                ++linepos;
+            }
+            inspace = newinspace;
+            linepos += charmemberwidth (c);
+	    OutputBuf[PendingOutput++] = c;
+	    if (OverStrike && !inspace) {
+		if (bold) {
+		    controlputc('\b');
+		    controlputc((int) c.ch);
+		}
+		if (highlight||underline) {
+		    controlputc('\b');
+		    controlputc('_');
+		}
+	    }
+            leftjustct += leftjustenv;
+            rightjustct += rightjustenv;
+            centerct += centerenv;
+            if (c.ch == '\014') inspace = 1;
+            if (linepos >= workingright) FlushOut();
+        }
+    }
+}
+
+static MakeWorkingMargins() {
+    int oldworkingleft=workingleft, i;
+
+    workingleft = leftmargin;
+    workingright = rightmargin;
+    if (workingleft < 0) workingleft = 0;
+    if (workingright < 0) workingright = 0;
+    if (workingright > (termcolumns - 1)) workingright = (termcolumns - 1);
+    if (workingleft > (workingright - 8)) workingleft = workingright -8;
+    if (linepos == oldworkingleft && linepos != 0) {
+        for (i=workingleft-oldworkingleft; i > 0; --i) OUTC(' ');
+    }
+}
+
+static Pause()
+{
+    int	c;
+
+    (void) fputs("Press RETURN to continue (or 'q' to quit):\n", stdout);
+    fflush(stdout);
+    c = getc(stdin);
+    if (c == 'q' || c == 'Q') exit(0);
+    linesused = 0;
+}
+
+/* Leading spaces should be output as MoveRight, to avoid 
+   having margins that are underlined or reverse video */
+
+static fputsmovingright(s, fp)
+struct charsetmember *s;
+FILE *fp;
+{
+    int inmargin=1;
+    if (!s) return;
+    while (s -> ch) {
+        if (inmargin && (s -> ch) == ' ') {
+            controloutput(MoveRight, 1);
+        } else {
+            if (inmargin) inmargin = 0;
+	    if (charisctrl (*s))
+	        (*RichtextPutc) ((int)(s -> ch), fp);
+	    else
+	    	charmemberrender (*s, fp);
+        }
+        ++s;
+    }
+}
+
+static ResetTerminalCodes(FakeTerminal, highlight, underline, bold, highlightbuf, highlightendbuf,
+                    modifiedhighlight, StartUnderline, StopUnderline, modifiedunderline,
+                    BoldOn, BoldOff, modifiedbold)
+char *highlightbuf, *highlightendbuf, *StartUnderline, *StopUnderline,
+    *BoldOn, *BoldOff;
+{
+    if (OverStrike)
+	return;
+
+    /* We always turn back on the appropriate terminal modes, because
+      on some terminals one thing turns off all of them */
+    if (highlight >= 1) {
+        if (FakeTerminal) {
+            if (modifiedhighlight && highlight == 1) outputstr(highlightbuf);
+        } else controloutput(highlightbuf, 0);
+    }
+    if (bold >= 1) {
+        if (FakeTerminal) {
+            if (modifiedbold && bold == 1) outputstr(BoldOn);
+        } else controloutput(BoldOn, 0);
+    }
+    if (underline >= 1) {
+        if (FakeTerminal) {
+            if (modifiedunderline && underline == 1) outputstr(StartUnderline);
+        } else controloutput(StartUnderline, 0);
+    }
+}
+
+static FinalizeTerminal() {
+    tputs(highlightendbuf, 1, immediate_controlputc);
+    tputs(BoldOff, 1, immediate_controlputc);
+    tputs(StopUnderline, 1, immediate_controlputc);
+    FPUTS(KE, stdout);
+}
+
+static outputstr(s)
+char *s;
+{
+    while (*s) OUTC(*s++);
+}
+
+static FPUTS(s,fp)
+unsigned char *s;
+FILE *fp;
+{
+    while(*s) (*RichtextPutc)((int)(*s++),fp);
+}
+
+static lc2strcmp(s1, s2)
+char *s1, *s2;
+{
+    if (!s1 || !s2) return (-1);
+    while (*s1 && *s2) {
+	if (*s1 != *s2 && (tolower(*s1) != *s2)) return(-1);
+	++s1; ++s2;
+    }
+    return((*s1 == *s2) ? 0 : -1);
+}
+
+static lc2strncmp(s1, s2, len)
+char *s1, *s2;
+int len;
+{
+    if (!s1 || !s2) return (-1);
+    while (*s1 && *s2 && len > 0) {
+	if (*s1 != *s2 && (tolower(*s1) != *s2)) return(-1);
+	++s1; ++s2; --len;
+    }
+    if (len <= 0) return(0);
+    return((*s1 == *s2) ? 0 : -1);
+}
--- metamail-2.7.orig/src/richmail/richset.c
+++ metamail-2.7/src/richmail/richset.c
@@ -0,0 +1,222 @@
+/*-------------------------------------------------------------------------
+
+  richset.c - Handling for different character sets in richtext.
+ 
+  Copyright (c) 1992 Rhys Weatherley
+
+  Permission to use, copy, modify, and distribute this material
+  for any purpose and without fee is hereby granted, provided
+  that the above copyright notice and this permission notice
+  appear in all copies, and that the name of Rhys Weatherley not be
+  used in advertising or publicity pertaining to this
+  material without specific, prior written permission.
+  RHYS WEATHERLEY MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR
+  SUITABILITY OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED
+  "AS IS", WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+
+  Revision History:
+  ================
+
+   Version  DD/MM/YY  By  Description
+   -------  --------  --  --------------------------------------
+     1.0    21/06/92  RW  Original Version of richset.c
+
+  You may contact the author by:
+  =============================
+
+   e-mail: rhys@cs.uq.oz.au
+     mail: Rhys Weatherley
+	   5 Horizon Drive
+	   Jamboree Heights
+	   Queensland 4074
+	   Australia
+
+-------------------------------------------------------------------------*/
+
+#include <metamail/common.h>
+
+#include "richlex.h"
+#include "richset.h"
+
+/*
+ * Define a list of all character set processors in memory.
+ */
+static	struct	charsetproc	*CharacterSets[] =
+	  {&usascii_charset,
+	   &iso2022_charset,
+	   NULL};
+
+/*
+ * Global data for this module.
+ */
+#define	MAX_CHAR_SETS	100
+static	int	NumCharSets=0;
+static	struct	charsetproc	*CharSets[MAX_CHAR_SETS];
+static	int	CharEncStack[MAX_CHAR_SETS];
+
+/*
+ * Initialise the stack of character set processors, starting with
+ * a particular base processor.  The initialisation function of all
+ * character set processors is called.
+ */
+charsetinit (charset,name)
+struct	charsetproc *charset;
+char	*name;
+{
+    int temp = 0;
+    CharSets[0] = charset;
+    NumCharSets = 1;
+    while (CharacterSets[temp]) {
+        (*(CharacterSets[temp] -> init))
+		((CharacterSets[temp] == charset ? name : NULL));
+	++temp;
+    }
+}
+
+/*
+ * Initialise the stack, starting with a character set processor with
+ * a particular name.
+ */
+charsetnameinit	(name)
+char	*name;
+{
+    int temp = 0;
+    int succeed = 0;
+    char *temp1,*temp2;
+    struct charsetproc *charset = &usascii_charset;
+    while (!succeed && CharacterSets[temp]) {
+	temp2 = CharacterSets[temp] -> names;
+	while (!succeed && *temp2) {
+	    temp1 = name;
+	    while (*temp1 && *temp2 && *temp2 != ':' && *temp2 == *temp1) {
+		++temp1;
+		++temp2;
+	    }
+	    if (*temp1 == '\0' && (*temp2 == '\0' || *temp2 == ':')) {
+		succeed = 1;
+		charset = CharacterSets[temp];
+	    }
+	    while (*temp2 && *temp2 != ':') {
+		++temp2;
+	    }
+	    if (*temp2 == ':') {
+		++temp2;
+	    }
+	}
+	++temp;
+    }
+    charsetinit (charset,name);
+}
+
+/*
+ * Push a new character set processor onto the stack.
+ */
+charsetpush (charset)
+struct	charsetproc *charset;
+{
+    if (NumCharSets >= MAX_CHAR_SETS) {
+    	fprintf (stderr,"Too many nested character sets: aborting\n");
+	exit (1);
+    } else {
+	CharEncStack[NumCharSets - 1] = RichtextCharEncoding;
+	(*(CharSets[NumCharSets - 1] -> encoding)) (-1); /* Leave current */
+    	CharSets[NumCharSets++] = charset;
+    }
+}
+
+/*
+ * Pop the top-most character set processor off the stack
+ * if it matches the given processor.  Note: the base
+ * processor is never popped off.
+ */
+charsetpop (charset)
+struct	charsetproc *charset;
+{
+    if (NumCharSets > 1 && CharSets[NumCharSets - 1] == charset) {
+        --NumCharSets;
+	richtextencoding (CharEncStack[NumCharSets - 1]);
+	(*(CharSets[NumCharSets - 1] -> encoding)) (RichtextCharEncoding);
+    }
+}
+
+/*
+ * See if the character set processor on the top of the stack
+ * matches the given processor.
+ */
+int	charsettop (charset)
+struct	charsetproc *charset;
+{
+    if (NumCharSets > 1) {
+	return (CharSets[NumCharSets - 1] == charset);
+    } else {
+	return (0);
+    }
+}
+
+/*
+ * Set the details for a character set member in the top-most
+ * character set.
+ */
+charmember (member,ch)
+struct	charsetmember *member;
+RCHAR	ch;
+{
+    member -> ch = ch;
+    member -> charset = CharSets[NumCharSets - 1];
+}
+
+/*
+ * Set the details for a member of a specific character set.
+ */
+charmemberspec (member,ch,charset)
+struct	charsetmember *member;
+RCHAR	ch;
+struct	charsetproc *charset;
+{
+    member -> ch = ch;
+    member -> charset = charset;
+}
+
+/*
+ * Set the details for a output control code character.
+ */
+charmemberctrl (member,ch)
+struct	charsetmember *member;
+RCHAR	ch;
+{
+    member -> ch = ch;
+    member -> charset = NULL;
+}
+
+/*
+ * Attempt to process a richtext command by passing it to the
+ * "command" function of all character set processors.  Returns
+ * zero if the command was not processed.
+ */
+int	charsetcommand (token,negated)
+char	*token;
+int	negated;
+{
+    int temp = 0;
+    while (CharacterSets[temp]) {
+    	if ((*(CharacterSets[temp] -> command)) (token,negated))
+	    return (1);
+	++temp;
+    }
+    return (0);
+}
+
+/*
+ * Test for an extension singleton command.
+ */
+int	charsetsingle (token)
+char	*token;
+{
+    int temp = 0;
+    while (CharacterSets[temp]) {
+    	if ((*(CharacterSets[temp] -> single)) (token))
+	    return (1);
+	++temp;
+    }
+    return (0);
+}
--- metamail-2.7.orig/src/richmail/richset.h
+++ metamail-2.7/src/richmail/richset.h
@@ -0,0 +1,172 @@
+/*-------------------------------------------------------------------------
+
+  richset.h - Handling for different character sets in richtext.
+ 
+  Copyright (c) 1992 Rhys Weatherley
+
+  Permission to use, copy, modify, and distribute this material
+  for any purpose and without fee is hereby granted, provided
+  that the above copyright notice and this permission notice
+  appear in all copies, and that the name of Rhys Weatherley not be
+  used in advertising or publicity pertaining to this
+  material without specific, prior written permission.
+  RHYS WEATHERLEY MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR
+  SUITABILITY OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED
+  "AS IS", WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+
+  Revision History:
+  ================
+
+   Version  DD/MM/YY  By  Description
+   -------  --------  --  --------------------------------------
+     1.0    19/06/92  RW  Original Version of richset.h
+
+  You may contact the author by:
+  =============================
+
+   e-mail: rhys@cs.uq.oz.au
+     mail: Rhys Weatherley
+	   5 Horizon Drive
+	   Jamboree Heights
+	   Queensland 4074
+	   Australia
+
+-------------------------------------------------------------------------*/
+
+#ifndef	__RICHSET_H__
+#define	__RICHSET_H__
+
+#include <metamail/common.h>
+
+BEGIN_C_DECLS
+
+/*
+ * Define the interface structure for a character set processor.
+ * The fields are as follows:
+ *
+ *	names	- Colon-separated list of character set names.
+ *	init	- Initialize the character set processor.
+ *	command	- Process a command before the default processing.
+ *		  Returns non-zero if processed, zero if not.
+ *	single	- Should return non-zero for a singleton command.
+ *	width	- Get the width in terminal characters of the character.
+ *	fold	- Returns non-zero if the character can be folded at.
+ *	render	- Render the character through RichtextPutc.
+ *	encoding- Enter or leave an encoding. newenc is -1 to leave.
+ *
+ */
+struct	charsetproc
+		{
+		    char *names;
+		    int (*init) ( /* char *name */ );
+		    int (*command) ( /* char *token, int negated */ );
+		    int (*single) ( /* char *token */ );
+		    int (*width) ( /* RCHAR c */ );
+		    int (*fold) ( /* RCHAR c */ );
+		    int (*render) ( /* RCHAR c, void *param */ );
+		    int (*encoding) ( /* int newenc */ );
+		};
+
+/*
+ * Define some standard character set processors.
+ */
+extern	struct 	charsetproc	usascii_charset;
+extern	struct	charsetproc	iso2022_charset;
+
+/*
+ * Define the information to be kept in the internal buffers
+ * about a character.  If "charset" is NULL, it is a control
+ * character.
+ */
+struct	charsetmember
+		{
+		    RCHAR ch;			 /* The character itself */
+		    struct charsetproc *charset; /* Character set of ch */
+		};
+
+/*
+ * Initialise the stack of character set processors, starting with
+ * a particular base processor.  The initialisation function of all
+ * character set processors is called.
+ */
+extern	charsetinit	( /* struct charsetproc *charset, char *name */ );
+
+/*
+ * Initialise the stack, starting with a character set processor with
+ * a particular name.
+ */
+extern	charsetnameinit	( /* char *name */ );
+
+/*
+ * Push a new character set processor onto the stack.
+ */
+extern	charsetpush	( /* struct charsetproc *charset */ );
+
+/*
+ * Pop the top-most character set processor off the stack
+ * if it matches the given processor.  Note: the base
+ * processor is never popped off.
+ */
+extern	charsetpop	( /* struct charsetproc *charset */ );
+
+/*
+ * See if the character set processor on the top of the stack
+ * matches the given processor.
+ */
+extern	int	charsettop ( /* struct charsetproc *charset */ );
+
+/*
+ * Set the details for a character set member in the top-most
+ * character set.
+ */
+extern	charmember	( /* struct charsetmember *member, RCHAR ch */ );
+
+/*
+ * Set the details for a member of a specific character set.
+ */
+extern	charmemberspec	( /* struct charsetmember *member, RCHAR ch,
+			     struct charset *charset */ );
+
+/*
+ * Set the details for a output control code character.
+ */
+extern	charmemberctrl	( /* struct charsetmember *member, RCHAR ch */ );
+
+/*
+ * Determine if the given character is a control code character.
+ */
+#define	charisctrl(member)	((member).charset == (struct charsetproc *)0)
+
+/*
+ * Attempt to process a richtext command by passing it to the
+ * "command" function of all character set processors.  Returns
+ * zero if the command was not processed.
+ */
+extern	int	charsetcommand	( /* char *token, int negated */ );
+
+/*
+ * Test for an extension singleton command.
+ */
+extern	int	charsetsingle	( /* char *token */ );
+
+/*
+ * Get the width of a particular character.
+ */
+#define	charmemberwidth(member) \
+		((*((member).charset -> width)) ((member).ch))
+
+/*
+ * Determine if a character can be folded at.
+ */
+#define	charmemberfold(member) \
+		((*((member).charset -> fold)) ((member).ch))
+
+/*
+ * Render a character on an output stream.
+ */
+#define	charmemberrender(member,param) \
+		((*((member).charset -> render)) ((member).ch,param))
+
+END_C_DECLS
+
+#endif	/* __RICHSET_H__ */
--- metamail-2.7.orig/src/richmail/richtoatk.c
+++ metamail-2.7/src/richmail/richtoatk.c
@@ -0,0 +1,98 @@
+/*
+Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
+
+Permission to use, copy, modify, and distribute this material 
+for any purpose and without fee is hereby granted, provided 
+that the above copyright notice and this permission notice 
+appear in all copies, and that the name of Bellcore not be 
+used in advertising or publicity pertaining to this 
+material without the specific, prior written permission 
+of an authorized representative of Bellcore.  BELLCORE 
+MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
+OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
+WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+*/
+#include <metamail/common.h>
+
+#include "richlex.h"
+
+char *translate(t)
+char *t;
+{
+    if (!strcmp(t, "fixed")) return("typewriter");
+    if (!strcmp(t, "excerpt")) return("quotation");
+    /* Really ought to handle ISO-10646 and ISO-8859-X somehow */
+    return(t);
+}
+
+main() {
+    RCHAR c;
+    int i, JustDidNewline = 0;
+    char tok[MAX_TOKEN_SIZE + 1],*token;
+
+    fputs("\\begindata{text, 42}\n\\template{messages}\n", stdout);
+    /* The 0, 0 means that we're not implementing text/enriched */
+    while((c = richtextlex(stdin,tok + 1, 0, 0)) != (RCHAR)EOF) {
+	if (c == RICHTEXT_COMMAND || c == RICHTEXT_NEG_COMMAND) {
+	    if (c == RICHTEXT_NEG_COMMAND) {
+		tok[0] = '/';
+		token = tok;
+	    } else
+		token = tok + 1;
+            if (!strcmp(token, "lt")) {
+                putc('<', stdout);
+                JustDidNewline = 0;
+            } else if (!strcmp(token, "nl")) {
+                fputs(JustDidNewline ? "\n" : "\n\n", stdout);
+                JustDidNewline = 1;
+            } else if (!strcmp(token, "/paragraph")) {
+                fputs(JustDidNewline ? "\n\n" : "\n\n\n", stdout);
+                JustDidNewline = 1;
+            } else if (!strcmp(token, "comment")) {
+	        int tempc;
+                while (strcmp(token, "/comment")) {
+                    while ((tempc = getc(stdin)) != '<') ;
+                    for (i=0; (tempc = getc(stdin)) != '>'; ++i) {
+                        token[i] = isupper(tempc) ? tolower(tempc) : tempc;
+                    }
+                    token[i] = '\0';
+                }
+            } else if (!ignoretoken(token)) {
+                if (token[0] == '/') {
+                    putc('}', stdout);
+                } else {
+                    fprintf(stdout, "\\%s{", translate(token));
+                    JustDidNewline = 0;
+                }
+            }
+        } else if (c == '\n') {
+            putc(' ', stdout);
+            JustDidNewline = 0;
+        } else {
+            putc((int)c, stdout);
+            JustDidNewline = 0;
+        }
+    }
+    fputs("\n \n\\enddata{text, 42}\n", stdout);
+}
+
+ignoretoken(t)
+char *t;
+{
+    if (*t == '/') ++t;
+    if (!strcmp(t, "us-ascii")) return(1);
+    if (!strcmp(t, "paragraph")) return(1); /* handled otherwise */
+    if (!strcmp(t, "no-op")) return(1);
+    return(0);
+}
+
+controlputc(c)
+int c;
+{
+}
+
+controloutput(s, immediate)
+char *s;
+int immediate;
+{
+}
--- metamail-2.7.orig/replace/vfprintf.c
+++ metamail-2.7/replace/vfprintf.c
@@ -0,0 +1,43 @@
+/* vfprintf.c -- implement vfprintf() for architectures without it
+   Copyright (C) 2000 Gary V. Vaughan
+  
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+  
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+  
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <stdio.h>
+
+#if HAVE_STDARG_H && !HAVE_VARARGS_H
+#  include <stdarg.h>
+#else /*!HAVE_STDARG_H || HAVE_VARARGS_H*/
+#  include <varargs.h>
+#endif /*HAVE_STDARG_H && !HAVE_VARARGS_H*/
+
+/* Some systems define this! */
+#undef vfprintf
+
+extern int _doprnt ();
+
+int
+vfprintf (file, format, ap)
+     FILE *file;
+     const char *format;
+     va_list ap;
+{
+   return _doprnt (format, ap, file);
+}
--- metamail-2.7.orig/replace/basename.c
+++ metamail-2.7/replace/basename.c
@@ -0,0 +1,45 @@
+/* basename.c -- implement basename() for architectures without it
+   Copyright (C) 2000 Gary V. Vaughan
+  
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+  
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+  
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#if HAVE_STRING_H
+#  include <string.h>
+#elif HAVE_STRINGS_H
+#  include <strings.h>
+#endif
+
+#if !HAVE_STRRCHR
+#  ifndef strrchr
+#    define strrchr rindex
+#  endif
+#endif
+
+char*
+basename (path)
+     char *path;
+{
+  /* Search for the last directory separator in PATH.  */
+  char *basename = strrchr (path, '/');
+  
+  /* If found, return the address of the following character,
+     or the start of the parameter passed in.  */
+  return basename ? ++basename : (char*)path;
+}
+
--- metamail-2.7.orig/replace/putenv.c
+++ metamail-2.7/replace/putenv.c
@@ -0,0 +1,100 @@
+/* Copyright (C) 1991 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <config.h>
+#include <sys/types.h>
+#include <errno.h>
+#ifdef STDC_HEADERS
+#include <stdlib.h>
+#else
+extern int errno;
+#endif
+
+#if defined(STDC_HEADERS) || defined(USG) || defined(SYSV)
+#include <string.h>
+#else /* not (STDC_HEADERS or USG) */
+#include <strings.h>
+#endif /* STDC_HEADERS or USG */
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+#if !__STDC__
+#define const
+#endif
+
+extern char **environ;
+
+/* Put STRING, which is of the form "NAME=VALUE", in the environment.  */
+int
+putenv (string)
+     const char *string;
+{
+  char *name_end = index (string, '=');
+  register size_t size;
+  register char **ep;
+
+  if (name_end == NULL)
+    {
+      /* Remove the variable from the environment.  */
+      size = strlen (string);
+      for (ep = environ; *ep != NULL; ++ep)
+	if (!strncmp (*ep, string, size) && (*ep)[size] == '=')
+	  {
+	    while (ep[1] != NULL)
+	      {
+		ep[0] = ep[1];
+		++ep;
+	      }
+	    *ep = NULL;
+	    return 0;
+	  }
+    }
+
+  size = 0;
+  for (ep = environ; *ep != NULL; ++ep)
+    if (!strncmp (*ep, string, name_end - string) &&
+	(*ep)[name_end - string] == '=')
+      break;
+    else
+      ++size;
+
+  if (*ep == NULL)
+    {
+      static char **last_environ = NULL;
+      char **new_environ = (char **) malloc ((size + 2) * sizeof (char *));
+      if (new_environ == NULL)
+	return -1;
+      (void) bcopy ((char *) environ, (char *) new_environ, size * sizeof (char *));
+      new_environ[size] = (char *) string;
+      new_environ[size + 1] = NULL;
+      if (last_environ != NULL)
+	free ((char *) last_environ);
+      last_environ = new_environ;
+      environ = new_environ;
+    }
+  else
+    *ep = (char *) string;
+
+  return 0;
+}
--- metamail-2.7.orig/replace/Makefile.am
+++ metamail-2.7/replace/Makefile.am
@@ -0,0 +1,9 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+
+MAINTAINERCLEANFILES	= Makefile.in
+
+INCLUDES		=  -I$(top_builddir) -I$(top_srcdir)
+
+noinst_LTLIBRARIES	= libreplace.la
+libreplace_la_SOURCES	= 
+libreplace_la_LIBADD	= @LTLIBOBJS@
--- metamail-2.7.orig/replace/Makefile.in
+++ metamail-2.7/replace/Makefile.in
@@ -0,0 +1,343 @@
+# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AS = @AS@
+CATCOMMAND = @CATCOMMAND@
+CC = @CC@
+DLLTOOL = @DLLTOOL@
+ECHO = @ECHO@
+EXEEXT = @EXEEXT@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LN_S = @LN_S@
+LPRCOMMAND = @LPRCOMMAND@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_aux_dir = @ac_aux_dir@
+
+MAINTAINERCLEANFILES = Makefile.in
+
+INCLUDES = -I$(top_builddir) -I$(top_srcdir)
+
+noinst_LTLIBRARIES = libreplace.la
+libreplace_la_SOURCES = 
+libreplace_la_LIBADD = @LTLIBOBJS@
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = ../metamail/config.h
+CONFIG_CLEAN_FILES = 
+LTLIBRARIES =  $(noinst_LTLIBRARIES)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir) -I../metamail
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+libreplace_la_LDFLAGS = 
+libreplace_la_DEPENDENCIES =  @LTLIBOBJS@
+libreplace_la_OBJECTS = 
+CFLAGS = @CFLAGS@
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+DIST_COMMON =  Makefile.am Makefile.in basename.c putenv.c strerror.c \
+vfprintf.c
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP_ENV = --best
+DEP_FILES =  .deps/basename.P .deps/putenv.P .deps/strerror.P \
+.deps/vfprintf.P
+SOURCES = $(libreplace_la_SOURCES)
+OBJECTS = $(libreplace_la_OBJECTS)
+
+all: all-redirect
+.SUFFIXES:
+.SUFFIXES: .S .c .lo .o .obj .s
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
+	cd $(top_srcdir) && $(AUTOMAKE) --foreign replace/Makefile
+
+Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
+	cd $(top_builddir) \
+	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+mostlyclean-noinstLTLIBRARIES:
+
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+
+distclean-noinstLTLIBRARIES:
+
+maintainer-clean-noinstLTLIBRARIES:
+
+# FIXME: We should only use cygpath when building on Windows,
+# and only if it is available.
+.c.obj:
+	$(COMPILE) -c `cygpath -w $<`
+
+.s.o:
+	$(COMPILE) -c $<
+
+.S.o:
+	$(COMPILE) -c $<
+
+mostlyclean-compile:
+	-rm -f *.o core *.core
+	-rm -f *.$(OBJEXT)
+
+clean-compile:
+
+distclean-compile:
+	-rm -f *.tab.c
+
+maintainer-clean-compile:
+
+.s.lo:
+	$(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+.S.lo:
+	$(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+
+maintainer-clean-libtool:
+
+libreplace.la: $(libreplace_la_OBJECTS) $(libreplace_la_DEPENDENCIES)
+	$(LINK)  $(libreplace_la_LDFLAGS) $(libreplace_la_OBJECTS) $(libreplace_la_LIBADD) $(LIBS)
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS)'; \
+	unique=`for i in $$list; do echo $$i; done | \
+	  awk '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	here=`pwd` && cd $(srcdir) \
+	  && mkid -f$$here/ID $$unique $(LISP)
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)'; \
+	unique=`for i in $$list; do echo $$i; done | \
+	  awk '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+	  || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags  $$unique $(LISP))
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+	-rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = replace
+
+distdir: $(DISTFILES)
+	here=`cd $(top_builddir) && pwd`; \
+	top_distdir=`cd $(top_distdir) && pwd`; \
+	distdir=`cd $(distdir) && pwd`; \
+	cd $(top_srcdir) \
+	  && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign replace/Makefile
+	@for file in $(DISTFILES); do \
+	  d=$(srcdir); \
+	  if test -d $$d/$$file; then \
+	    cp -pr $$d/$$file $(distdir)/$$file; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+	    || cp -p $$d/$$file $(distdir)/$$file || :; \
+	  fi; \
+	done
+
+DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
+
+-include $(DEP_FILES)
+
+mostlyclean-depend:
+
+clean-depend:
+
+distclean-depend:
+	-rm -rf .deps
+
+maintainer-clean-depend:
+
+%.o: %.c
+	@echo '$(COMPILE) -c $<'; \
+	$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+	@-cp .deps/$(*F).pp .deps/$(*F).P; \
+	tr ' ' '\012' < .deps/$(*F).pp \
+	  | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+	    >> .deps/$(*F).P; \
+	rm .deps/$(*F).pp
+
+%.lo: %.c
+	@echo '$(LTCOMPILE) -c $<'; \
+	$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+	@-sed -e 's/^\([^:]*\)\.o[ 	]*:/\1.lo \1.o :/' \
+	  < .deps/$(*F).pp > .deps/$(*F).P; \
+	tr ' ' '\012' < .deps/$(*F).pp \
+	  | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+	    >> .deps/$(*F).P; \
+	rm -f .deps/$(*F).pp
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am:
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am:
+uninstall: uninstall-am
+all-am: Makefile $(LTLIBRARIES)
+all-redirect: all-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs:
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f Makefile $(CONFIG_CLEAN_FILES)
+	-rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+	-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+mostlyclean-am:  mostlyclean-noinstLTLIBRARIES mostlyclean-compile \
+		mostlyclean-libtool mostlyclean-tags mostlyclean-depend \
+		mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am:  clean-noinstLTLIBRARIES clean-compile clean-libtool \
+		clean-tags clean-depend clean-generic mostlyclean-am
+
+clean: clean-am
+
+distclean-am:  distclean-noinstLTLIBRARIES distclean-compile \
+		distclean-libtool distclean-tags distclean-depend \
+		distclean-generic clean-am
+	-rm -f libtool
+
+distclean: distclean-am
+
+maintainer-clean-am:  maintainer-clean-noinstLTLIBRARIES \
+		maintainer-clean-compile maintainer-clean-libtool \
+		maintainer-clean-tags maintainer-clean-depend \
+		maintainer-clean-generic distclean-am
+	@echo "This command is intended for maintainers to use;"
+	@echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-am
+
+.PHONY: mostlyclean-noinstLTLIBRARIES distclean-noinstLTLIBRARIES \
+clean-noinstLTLIBRARIES maintainer-clean-noinstLTLIBRARIES \
+mostlyclean-compile distclean-compile clean-compile \
+maintainer-clean-compile mostlyclean-libtool distclean-libtool \
+clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags distdir \
+mostlyclean-depend distclean-depend clean-depend \
+maintainer-clean-depend info-am info dvi-am dvi check check-am \
+installcheck-am installcheck install-exec-am install-exec \
+install-data-am install-data install-am install uninstall-am uninstall \
+all-redirect all-am all installdirs mostlyclean-generic \
+distclean-generic clean-generic maintainer-clean-generic clean \
+mostlyclean distclean maintainer-clean
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
--- metamail-2.7.orig/replace/strerror.c
+++ metamail-2.7/replace/strerror.c
@@ -0,0 +1,610 @@
+/* strerror.c -- implement strerror() for architectures without it
+   Written by Fred Fish.  fnf@cygnus.com
+   This file is in the public domain.  --Per Bothner.
+*/
+
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#ifdef HAVE_SYS_ERRLIST
+/* Note that errno.h (not sure what OS) or stdio.h (BSD 4.4, at least)
+   might declare sys_errlist in a way that the compiler might consider
+   incompatible with our later declaration, perhaps by using const
+   attributes.  So we hide the declaration in errno.h (if any) using a
+   macro. */
+#define sys_errlist no_such_symbol
+#endif
+
+#include <stdio.h>
+
+#if HAVE_ERRNO_H
+#  include <errno.h>
+#endif
+
+#ifdef HAVE_SYS_ERRLIST
+#  undef sys_errlist
+#endif
+
+/*  Routines imported from standard C runtime libraries. */
+
+#ifdef __STDC__
+#include <stddef.h>
+extern void *malloc (size_t size);				/* 4.10.3.3 */
+extern void *memset (void *s, int c, size_t n);			/* 4.11.6.1 */
+#else	/* !__STDC__ */
+extern char *malloc ();		/* Standard memory allocater */
+extern char *memset ();
+#endif	/* __STDC__ */
+
+#ifndef MAX
+#  define MAX(a,b) ((a) > (b) ? (a) : (b))
+#endif
+
+/* Translation table for errno values.  See intro(2) in most UNIX systems
+   Programmers Reference Manuals.
+
+   Note that this table is generally only accessed when it is used at runtime
+   to initialize errno name and message tables that are indexed by errno
+   value.
+
+   Not all of these errnos will exist on all systems.  This table is the only
+   thing that should have to be updated as new error numbers are introduced.
+   It's sort of ugly, but at least its portable. */
+
+struct error_info
+{
+  int value;		/* The numeric value from <errno.h> */
+  const char *name;	/* The equivalent symbolic value */
+#ifndef HAVE_SYS_ERRLIST
+  const char *msg;	/* Short message about this value */
+#endif
+};
+
+#ifndef HAVE_SYS_ERRLIST
+#   define ENTRY(value, name, msg)	{value, name, msg}
+#else
+#   define ENTRY(value, name, msg)	{value, name}
+#endif
+
+static const struct error_info error_table[] =
+{
+#if defined (EPERM)
+  ENTRY(EPERM, "EPERM", "Not owner"),
+#endif
+#if defined (ENOENT)
+  ENTRY(ENOENT, "ENOENT", "No such file or directory"),
+#endif
+#if defined (ESRCH)
+  ENTRY(ESRCH, "ESRCH", "No such process"),
+#endif
+#if defined (EINTR)
+  ENTRY(EINTR, "EINTR", "Interrupted system call"),
+#endif
+#if defined (EIO)
+  ENTRY(EIO, "EIO", "I/O error"),
+#endif
+#if defined (ENXIO)
+  ENTRY(ENXIO, "ENXIO", "No such device or address"),
+#endif
+#if defined (E2BIG)
+  ENTRY(E2BIG, "E2BIG", "Arg list too long"),
+#endif
+#if defined (ENOEXEC)
+  ENTRY(ENOEXEC, "ENOEXEC", "Exec format error"),
+#endif
+#if defined (EBADF)
+  ENTRY(EBADF, "EBADF", "Bad file number"),
+#endif
+#if defined (ECHILD)
+  ENTRY(ECHILD, "ECHILD", "No child processes"),
+#endif
+#if defined (EWOULDBLOCK)	/* Put before EAGAIN, sometimes aliased */
+  ENTRY(EWOULDBLOCK, "EWOULDBLOCK", "Operation would block"),
+#endif
+#if defined (EAGAIN)
+  ENTRY(EAGAIN, "EAGAIN", "No more processes"),
+#endif
+#if defined (ENOMEM)
+  ENTRY(ENOMEM, "ENOMEM", "Not enough space"),
+#endif
+#if defined (EACCES)
+  ENTRY(EACCES, "EACCES", "Permission denied"),
+#endif
+#if defined (EFAULT)
+  ENTRY(EFAULT, "EFAULT", "Bad address"),
+#endif
+#if defined (ENOTBLK)
+  ENTRY(ENOTBLK, "ENOTBLK", "Block device required"),
+#endif
+#if defined (EBUSY)
+  ENTRY(EBUSY, "EBUSY", "Device busy"),
+#endif
+#if defined (EEXIST)
+  ENTRY(EEXIST, "EEXIST", "File exists"),
+#endif
+#if defined (EXDEV)
+  ENTRY(EXDEV, "EXDEV", "Cross-device link"),
+#endif
+#if defined (ENODEV)
+  ENTRY(ENODEV, "ENODEV", "No such device"),
+#endif
+#if defined (ENOTDIR)
+  ENTRY(ENOTDIR, "ENOTDIR", "Not a directory"),
+#endif
+#if defined (EISDIR)
+  ENTRY(EISDIR, "EISDIR", "Is a directory"),
+#endif
+#if defined (EINVAL)
+  ENTRY(EINVAL, "EINVAL", "Invalid argument"),
+#endif
+#if defined (ENFILE)
+  ENTRY(ENFILE, "ENFILE", "File table overflow"),
+#endif
+#if defined (EMFILE)
+  ENTRY(EMFILE, "EMFILE", "Too many open files"),
+#endif
+#if defined (ENOTTY)
+  ENTRY(ENOTTY, "ENOTTY", "Not a typewriter"),
+#endif
+#if defined (ETXTBSY)
+  ENTRY(ETXTBSY, "ETXTBSY", "Text file busy"),
+#endif
+#if defined (EFBIG)
+  ENTRY(EFBIG, "EFBIG", "File too large"),
+#endif
+#if defined (ENOSPC)
+  ENTRY(ENOSPC, "ENOSPC", "No space left on device"),
+#endif
+#if defined (ESPIPE)
+  ENTRY(ESPIPE, "ESPIPE", "Illegal seek"),
+#endif
+#if defined (EROFS)
+  ENTRY(EROFS, "EROFS", "Read-only file system"),
+#endif
+#if defined (EMLINK)
+  ENTRY(EMLINK, "EMLINK", "Too many links"),
+#endif
+#if defined (EPIPE)
+  ENTRY(EPIPE, "EPIPE", "Broken pipe"),
+#endif
+#if defined (EDOM)
+  ENTRY(EDOM, "EDOM", "Math argument out of domain of func"),
+#endif
+#if defined (ERANGE)
+  ENTRY(ERANGE, "ERANGE", "Math result not representable"),
+#endif
+#if defined (ENOMSG)
+  ENTRY(ENOMSG, "ENOMSG", "No message of desired type"),
+#endif
+#if defined (EIDRM)
+  ENTRY(EIDRM, "EIDRM", "Identifier removed"),
+#endif
+#if defined (ECHRNG)
+  ENTRY(ECHRNG, "ECHRNG", "Channel number out of range"),
+#endif
+#if defined (EL2NSYNC)
+  ENTRY(EL2NSYNC, "EL2NSYNC", "Level 2 not synchronized"),
+#endif
+#if defined (EL3HLT)
+  ENTRY(EL3HLT, "EL3HLT", "Level 3 halted"),
+#endif
+#if defined (EL3RST)
+  ENTRY(EL3RST, "EL3RST", "Level 3 reset"),
+#endif
+#if defined (ELNRNG)
+  ENTRY(ELNRNG, "ELNRNG", "Link number out of range"),
+#endif
+#if defined (EUNATCH)
+  ENTRY(EUNATCH, "EUNATCH", "Protocol driver not attached"),
+#endif
+#if defined (ENOCSI)
+  ENTRY(ENOCSI, "ENOCSI", "No CSI structure available"),
+#endif
+#if defined (EL2HLT)
+  ENTRY(EL2HLT, "EL2HLT", "Level 2 halted"),
+#endif
+#if defined (EDEADLK)
+  ENTRY(EDEADLK, "EDEADLK", "Deadlock condition"),
+#endif
+#if defined (ENOLCK)
+  ENTRY(ENOLCK, "ENOLCK", "No record locks available"),
+#endif
+#if defined (EBADE)
+  ENTRY(EBADE, "EBADE", "Invalid exchange"),
+#endif
+#if defined (EBADR)
+  ENTRY(EBADR, "EBADR", "Invalid request descriptor"),
+#endif
+#if defined (EXFULL)
+  ENTRY(EXFULL, "EXFULL", "Exchange full"),
+#endif
+#if defined (ENOANO)
+  ENTRY(ENOANO, "ENOANO", "No anode"),
+#endif
+#if defined (EBADRQC)
+  ENTRY(EBADRQC, "EBADRQC", "Invalid request code"),
+#endif
+#if defined (EBADSLT)
+  ENTRY(EBADSLT, "EBADSLT", "Invalid slot"),
+#endif
+#if defined (EDEADLOCK)
+  ENTRY(EDEADLOCK, "EDEADLOCK", "File locking deadlock error"),
+#endif
+#if defined (EBFONT)
+  ENTRY(EBFONT, "EBFONT", "Bad font file format"),
+#endif
+#if defined (ENOSTR)
+  ENTRY(ENOSTR, "ENOSTR", "Device not a stream"),
+#endif
+#if defined (ENODATA)
+  ENTRY(ENODATA, "ENODATA", "No data available"),
+#endif
+#if defined (ETIME)
+  ENTRY(ETIME, "ETIME", "Timer expired"),
+#endif
+#if defined (ENOSR)
+  ENTRY(ENOSR, "ENOSR", "Out of streams resources"),
+#endif
+#if defined (ENONET)
+  ENTRY(ENONET, "ENONET", "Machine is not on the network"),
+#endif
+#if defined (ENOPKG)
+  ENTRY(ENOPKG, "ENOPKG", "Package not installed"),
+#endif
+#if defined (EREMOTE)
+  ENTRY(EREMOTE, "EREMOTE", "Object is remote"),
+#endif
+#if defined (ENOLINK)
+  ENTRY(ENOLINK, "ENOLINK", "Link has been severed"),
+#endif
+#if defined (EADV)
+  ENTRY(EADV, "EADV", "Advertise error"),
+#endif
+#if defined (ESRMNT)
+  ENTRY(ESRMNT, "ESRMNT", "Srmount error"),
+#endif
+#if defined (ECOMM)
+  ENTRY(ECOMM, "ECOMM", "Communication error on send"),
+#endif
+#if defined (EPROTO)
+  ENTRY(EPROTO, "EPROTO", "Protocol error"),
+#endif
+#if defined (EMULTIHOP)
+  ENTRY(EMULTIHOP, "EMULTIHOP", "Multihop attempted"),
+#endif
+#if defined (EDOTDOT)
+  ENTRY(EDOTDOT, "EDOTDOT", "RFS specific error"),
+#endif
+#if defined (EBADMSG)
+  ENTRY(EBADMSG, "EBADMSG", "Not a data message"),
+#endif
+#if defined (ENAMETOOLONG)
+  ENTRY(ENAMETOOLONG, "ENAMETOOLONG", "File name too long"),
+#endif
+#if defined (EOVERFLOW)
+  ENTRY(EOVERFLOW, "EOVERFLOW", "Value too large for defined data type"),
+#endif
+#if defined (ENOTUNIQ)
+  ENTRY(ENOTUNIQ, "ENOTUNIQ", "Name not unique on network"),
+#endif
+#if defined (EBADFD)
+  ENTRY(EBADFD, "EBADFD", "File descriptor in bad state"),
+#endif
+#if defined (EREMCHG)
+  ENTRY(EREMCHG, "EREMCHG", "Remote address changed"),
+#endif
+#if defined (ELIBACC)
+  ENTRY(ELIBACC, "ELIBACC", "Can not access a needed shared library"),
+#endif
+#if defined (ELIBBAD)
+  ENTRY(ELIBBAD, "ELIBBAD", "Accessing a corrupted shared library"),
+#endif
+#if defined (ELIBSCN)
+  ENTRY(ELIBSCN, "ELIBSCN", ".lib section in a.out corrupted"),
+#endif
+#if defined (ELIBMAX)
+  ENTRY(ELIBMAX, "ELIBMAX", "Attempting to link in too many shared libraries"),
+#endif
+#if defined (ELIBEXEC)
+  ENTRY(ELIBEXEC, "ELIBEXEC", "Cannot exec a shared library directly"),
+#endif
+#if defined (EILSEQ)
+  ENTRY(EILSEQ, "EILSEQ", "Illegal byte sequence"),
+#endif
+#if defined (ENOSYS)
+  ENTRY(ENOSYS, "ENOSYS", "Operation not applicable"),
+#endif
+#if defined (ELOOP)
+  ENTRY(ELOOP, "ELOOP", "Too many symbolic links encountered"),
+#endif
+#if defined (ERESTART)
+  ENTRY(ERESTART, "ERESTART", "Interrupted system call should be restarted"),
+#endif
+#if defined (ESTRPIPE)
+  ENTRY(ESTRPIPE, "ESTRPIPE", "Streams pipe error"),
+#endif
+#if defined (ENOTEMPTY)
+  ENTRY(ENOTEMPTY, "ENOTEMPTY", "Directory not empty"),
+#endif
+#if defined (EUSERS)
+  ENTRY(EUSERS, "EUSERS", "Too many users"),
+#endif
+#if defined (ENOTSOCK)
+  ENTRY(ENOTSOCK, "ENOTSOCK", "Socket operation on non-socket"),
+#endif
+#if defined (EDESTADDRREQ)
+  ENTRY(EDESTADDRREQ, "EDESTADDRREQ", "Destination address required"),
+#endif
+#if defined (EMSGSIZE)
+  ENTRY(EMSGSIZE, "EMSGSIZE", "Message too long"),
+#endif
+#if defined (EPROTOTYPE)
+  ENTRY(EPROTOTYPE, "EPROTOTYPE", "Protocol wrong type for socket"),
+#endif
+#if defined (ENOPROTOOPT)
+  ENTRY(ENOPROTOOPT, "ENOPROTOOPT", "Protocol not available"),
+#endif
+#if defined (EPROTONOSUPPORT)
+  ENTRY(EPROTONOSUPPORT, "EPROTONOSUPPORT", "Protocol not supported"),
+#endif
+#if defined (ESOCKTNOSUPPORT)
+  ENTRY(ESOCKTNOSUPPORT, "ESOCKTNOSUPPORT", "Socket type not supported"),
+#endif
+#if defined (EOPNOTSUPP)
+  ENTRY(EOPNOTSUPP, "EOPNOTSUPP", "Operation not supported on transport endpoint"),
+#endif
+#if defined (EPFNOSUPPORT)
+  ENTRY(EPFNOSUPPORT, "EPFNOSUPPORT", "Protocol family not supported"),
+#endif
+#if defined (EAFNOSUPPORT)
+  ENTRY(EAFNOSUPPORT, "EAFNOSUPPORT", "Address family not supported by protocol"),
+#endif
+#if defined (EADDRINUSE)
+  ENTRY(EADDRINUSE, "EADDRINUSE", "Address already in use"),
+#endif
+#if defined (EADDRNOTAVAIL)
+  ENTRY(EADDRNOTAVAIL, "EADDRNOTAVAIL","Cannot assign requested address"),
+#endif
+#if defined (ENETDOWN)
+  ENTRY(ENETDOWN, "ENETDOWN", "Network is down"),
+#endif
+#if defined (ENETUNREACH)
+  ENTRY(ENETUNREACH, "ENETUNREACH", "Network is unreachable"),
+#endif
+#if defined (ENETRESET)
+  ENTRY(ENETRESET, "ENETRESET", "Network dropped connection because of reset"),
+#endif
+#if defined (ECONNABORTED)
+  ENTRY(ECONNABORTED, "ECONNABORTED", "Software caused connection abort"),
+#endif
+#if defined (ECONNRESET)
+  ENTRY(ECONNRESET, "ECONNRESET", "Connection reset by peer"),
+#endif
+#if defined (ENOBUFS)
+  ENTRY(ENOBUFS, "ENOBUFS", "No buffer space available"),
+#endif
+#if defined (EISCONN)
+  ENTRY(EISCONN, "EISCONN", "Transport endpoint is already connected"),
+#endif
+#if defined (ENOTCONN)
+  ENTRY(ENOTCONN, "ENOTCONN", "Transport endpoint is not connected"),
+#endif
+#if defined (ESHUTDOWN)
+  ENTRY(ESHUTDOWN, "ESHUTDOWN", "Cannot send after transport endpoint shutdown"),
+#endif
+#if defined (ETOOMANYREFS)
+  ENTRY(ETOOMANYREFS, "ETOOMANYREFS", "Too many references: cannot splice"),
+#endif
+#if defined (ETIMEDOUT)
+  ENTRY(ETIMEDOUT, "ETIMEDOUT", "Connection timed out"),
+#endif
+#if defined (ECONNREFUSED)
+  ENTRY(ECONNREFUSED, "ECONNREFUSED", "Connection refused"),
+#endif
+#if defined (EHOSTDOWN)
+  ENTRY(EHOSTDOWN, "EHOSTDOWN", "Host is down"),
+#endif
+#if defined (EHOSTUNREACH)
+  ENTRY(EHOSTUNREACH, "EHOSTUNREACH", "No route to host"),
+#endif
+#if defined (EALREADY)
+  ENTRY(EALREADY, "EALREADY", "Operation already in progress"),
+#endif
+#if defined (EINPROGRESS)
+  ENTRY(EINPROGRESS, "EINPROGRESS", "Operation now in progress"),
+#endif
+#if defined (ESTALE)
+  ENTRY(ESTALE, "ESTALE", "Stale NFS file handle"),
+#endif
+#if defined (EUCLEAN)
+  ENTRY(EUCLEAN, "EUCLEAN", "Structure needs cleaning"),
+#endif
+#if defined (ENOTNAM)
+  ENTRY(ENOTNAM, "ENOTNAM", "Not a XENIX named type file"),
+#endif
+#if defined (ENAVAIL)
+  ENTRY(ENAVAIL, "ENAVAIL", "No XENIX semaphores available"),
+#endif
+#if defined (EISNAM)
+  ENTRY(EISNAM, "EISNAM", "Is a named type file"),
+#endif
+#if defined (EREMOTEIO)
+  ENTRY(EREMOTEIO, "EREMOTEIO", "Remote I/O error"),
+#endif
+  ENTRY(0, NULL, NULL)
+};
+
+#ifdef EVMSERR
+/* This is not in the table, because the numeric value of EVMSERR (32767)
+   lies outside the range of sys_errlist[].  */
+static struct { int value; const char *name, *msg; }
+  evmserr = { EVMSERR, "EVMSERR", "VMS-specific error" };
+#endif
+
+/* Translation table allocated and initialized at runtime.  Indexed by the
+   errno value to find the equivalent symbolic value. */
+
+static const char **error_names;
+static int num_error_names = 0;
+
+/* Translation table allocated and initialized at runtime, if it does not
+   already exist in the host environment.  Indexed by the errno value to find
+   the descriptive string.
+
+   We don't export it for use in other modules because even though it has the
+   same name, it differs from other implementations in that it is dynamically
+   initialized rather than statically initialized. */
+
+#ifndef HAVE_SYS_ERRLIST
+
+static int sys_nerr;
+static const char **sys_errlist;
+
+#else
+
+extern int sys_nerr;
+extern char *sys_errlist[];
+
+#endif
+
+
+#ifndef HAVE_SYS_ERRLIST
+/*
+
+NAME
+
+	init_error_tables -- initialize the name and message tables
+
+SYNOPSIS
+
+	static void init_error_tables ();
+
+DESCRIPTION
+
+	Using the error_table, which is initialized at compile time, generate
+	the error_names and the sys_errlist (if needed) tables, which are
+	indexed at runtime by a specific errno value.
+
+BUGS
+
+	The initialization of the tables may fail under low memory conditions,
+	in which case we don't do anything particularly useful, but we don't
+	bomb either.  Who knows, it might succeed at a later point if we free
+	some memory in the meantime.  In any case, the other routines know
+	how to deal with lack of a table after trying to initialize it.  This
+	may or may not be considered to be a bug, that we don't specifically
+	warn about this particular failure mode.
+
+*/
+
+static void
+init_error_tables ()
+{
+  const struct error_info *eip;
+  int nbytes;
+
+  /* If we haven't already scanned the error_table once to find the maximum
+     errno value, then go find it now. */
+
+  if (num_error_names == 0)
+    {
+      for (eip = error_table; eip -> name != NULL; eip++)
+	{
+	  if (eip -> value >= num_error_names)
+	    {
+	      num_error_names = eip -> value + 1;
+	    }
+	}
+    }
+
+  /* Now attempt to allocate the sys_errlist table, zero it out, and then
+     initialize it from the statically initialized error_table. */
+
+  if (sys_errlist == NULL)
+    {
+      nbytes = num_error_names * sizeof (char *);
+      if ((sys_errlist = (const char **) malloc (nbytes)) != NULL)
+	{
+	  memset (sys_errlist, 0, nbytes);
+	  sys_nerr = num_error_names;
+	  for (eip = error_table; eip -> name != NULL; eip++)
+	    {
+	      sys_errlist[eip -> value] = eip -> msg;
+	    }
+	}
+    }
+}
+#endif
+
+
+/*
+
+NAME
+
+	strerror -- map an error number to an error message string
+
+SYNOPSIS
+
+	char *strerror (int errnoval)
+
+DESCRIPTION
+
+	Maps an errno number to an error message string, the contents of
+	which are implementation defined.  On systems which have the external
+	variables sys_nerr and sys_errlist, these strings will be the same
+	as the ones used by perror().
+
+	If the supplied error number is within the valid range of indices
+	for the sys_errlist, but no message is available for the particular
+	error number, then returns the string "Error NUM", where NUM is the
+	error number.
+
+	If the supplied error number is not a valid index into sys_errlist,
+	returns NULL.
+
+	The returned string is only guaranteed to be valid only until the
+	next call to strerror.
+
+*/
+
+char *
+strerror (errnoval)
+  int errnoval;
+{
+  char *msg;
+  static char buf[32];
+
+#ifndef HAVE_SYS_ERRLIST
+
+  if (error_names == NULL)
+    {
+      init_error_tables ();
+    }
+
+#endif
+
+  if ((errnoval < 0) || (errnoval >= sys_nerr))
+    {
+#ifdef EVMSERR
+      if (errnoval == evmserr.value)
+	msg = evmserr.msg;
+      else
+#endif
+      /* Out of range, just return NULL */
+      msg = NULL;
+    }
+  else if ((sys_errlist == NULL) || (sys_errlist[errnoval] == NULL))
+    {
+      /* In range, but no sys_errlist or no entry at this index. */
+      sprintf (buf, "Error %d", errnoval);
+      msg = buf;
+    }
+  else
+    {
+      /* In range, and a valid message.  Just return the message. */
+      msg = (char *) sys_errlist[errnoval];
+    }
+  
+  return (msg);
+}
--- metamail-2.7.orig/aclocal.m4
+++ metamail-2.7/aclocal.m4
@@ -0,0 +1,3824 @@
+dnl aclocal.m4 generated automatically by aclocal 1.4-p6
+
+dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+dnl PARTICULAR PURPOSE.
+
+# Like AC_CONFIG_HEADER, but automatically create stamp file.
+
+AC_DEFUN([AM_CONFIG_HEADER],
+[AC_PREREQ([2.12])
+AC_CONFIG_HEADER([$1])
+dnl When config.status generates a header, we must update the stamp-h file.
+dnl This file resides in the same directory as the config header
+dnl that is generated.  We must strip everything past the first ":",
+dnl and everything past the last "/".
+AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
+ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
+<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
+<<am_indx=1
+for am_file in <<$1>>; do
+  case " <<$>>CONFIG_HEADERS " in
+  *" <<$>>am_file "*<<)>>
+    echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
+    ;;
+  esac
+  am_indx=`expr "<<$>>am_indx" + 1`
+done<<>>dnl>>)
+changequote([,]))])
+
+# Do all the work for Automake.  This macro actually does too much --
+# some checks are only needed if your package does certain things.
+# But this isn't really a big deal.
+
+# serial 1
+
+dnl Usage:
+dnl AM_INIT_AUTOMAKE(package,version, [no-define])
+
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])
+PACKAGE=[$1]
+AC_SUBST(PACKAGE)
+VERSION=[$2]
+AC_SUBST(VERSION)
+dnl test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+ifelse([$3],,
+AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
+AC_REQUIRE([AM_SANITY_CHECK])
+AC_REQUIRE([AC_ARG_PROGRAM])
+dnl FIXME This is truly gross.
+missing_dir=`cd $ac_aux_dir && pwd`
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir)
+AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir)
+AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
+AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
+AC_REQUIRE([AC_PROG_MAKE_SET])])
+
+# Copyright 2002  Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+	 [AM_AUTOMAKE_VERSION([1.4-p6])])
+
+#
+# Check to make sure that the build environment is sane.
+#
+
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+   if test "[$]*" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftestfile`
+   fi
+   if test "[$]*" != "X $srcdir/configure conftestfile" \
+      && test "[$]*" != "X conftestfile $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
+   test "[$]2" = conftestfile
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+rm -f conftest*
+AC_MSG_RESULT(yes)])
+
+dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
+dnl The program must properly implement --version.
+AC_DEFUN([AM_MISSING_PROG],
+[AC_MSG_CHECKING(for working $2)
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf.  Sigh.
+if ($2 --version) < /dev/null > /dev/null 2>&1; then
+   $1=$2
+   AC_MSG_RESULT(found)
+else
+   $1="$3/missing $2"
+   AC_MSG_RESULT(missing)
+fi
+AC_SUBST($1)])
+
+# Add --enable-maintainer-mode option to configure.
+# From Jim Meyering
+
+# serial 1
+
+AC_DEFUN([AM_MAINTAINER_MODE],
+[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+  dnl maintainer-mode is disabled by default
+  AC_ARG_ENABLE(maintainer-mode,
+[  --enable-maintainer-mode enable make rules and dependencies not useful
+                          (and sometimes confusing) to the casual installer],
+      USE_MAINTAINER_MODE=$enableval,
+      USE_MAINTAINER_MODE=no)
+  AC_MSG_RESULT($USE_MAINTAINER_MODE)
+  AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
+  MAINT=$MAINTAINER_MODE_TRUE
+  AC_SUBST(MAINT)dnl
+]
+)
+
+# Define a conditional.
+
+AC_DEFUN([AM_CONDITIONAL],
+[AC_SUBST($1_TRUE)
+AC_SUBST($1_FALSE)
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi])
+
+# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*-
+
+# serial 46 AC_PROG_LIBTOOL
+
+AC_DEFUN([AC_PROG_LIBTOOL],
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Prevent multiple expansion
+define([AC_PROG_LIBTOOL], [])
+])
+
+AC_DEFUN([AC_LIBTOOL_SETUP],
+[AC_PREREQ(2.13)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+AC_REQUIRE([LT_AC_PROG_SED])dnl
+
+AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
+dnl
+
+_LT_AC_PROG_ECHO_BACKSLASH
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    AC_PATH_MAGIC
+  fi
+  ;;
+esac
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
+ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+enable_win32_dll=yes, enable_win32_dll=no)
+
+AC_ARG_ENABLE(libtool-lock,
+  [  --disable-libtool-lock  avoid locking (might break parallel builds)])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_SAVE
+     AC_LANG_C
+     AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_RESTORE])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+
+  # recent cygwin and mingw systems supply a stub DllMain which the user
+  # can override, but on older systems we have to supply one
+  AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain,
+    [AC_TRY_LINK([],
+      [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
+      DllMain (0, 0, 0);],
+      [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])])
+
+  case $host/$CC in
+  *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
+    # old mingw systems require "-dll" to link a DLL, while more recent ones
+    # require "-mdll"
+    SAVE_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS -mdll"
+    AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
+      [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
+    CFLAGS="$SAVE_CFLAGS" ;;
+  *-*-cygwin* | *-*-pw32*)
+    # cygwin systems need to pass --dll to the linker, and not link
+    # crt.o which will require a WinMain@16 definition.
+    lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
+  esac
+  ;;
+  ])
+esac
+
+_LT_AC_LTCONFIG_HACK
+
+])
+
+# AC_LIBTOOL_HEADER_ASSERT
+# ------------------------
+AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT],
+[AC_CACHE_CHECK([whether $CC supports assert without backlinking],
+    [lt_cv_func_assert_works],
+    [case $host in
+    *-*-solaris*)
+      if test "$GCC" = yes && test "$with_gnu_ld" != yes; then
+        case `$CC --version 2>/dev/null` in
+        [[12]].*) lt_cv_func_assert_works=no ;;
+        *)        lt_cv_func_assert_works=yes ;;
+        esac
+      fi
+      ;;
+    esac])
+
+if test "x$lt_cv_func_assert_works" = xyes; then
+  AC_CHECK_HEADERS(assert.h)
+fi
+])# AC_LIBTOOL_HEADER_ASSERT
+
+# _LT_AC_CHECK_DLFCN
+# --------------------
+AC_DEFUN([_LT_AC_CHECK_DLFCN],
+[AC_CHECK_HEADERS(dlfcn.h)
+])# _LT_AC_CHECK_DLFCN
+
+# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+# ---------------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
+[AC_REQUIRE([AC_CANONICAL_HOST])
+AC_REQUIRE([AC_PROG_NM])
+AC_REQUIRE([AC_OBJEXT])
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Transform the above into a raw symbol and a C symbol.
+symxfrm='\1 \2\3 \3'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[[BCDT]]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[[ABCDGISTW]]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+  lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  ;;
+irix* | nonstopux*)
+  symcode='[[BCDEGRST]]'
+  ;;
+osf*)
+  symcode='[[BCDEGQRST]]'
+  ;;
+solaris* | sysv5*)
+  symcode='[[BDT]]'
+  ;;
+sysv4)
+  symcode='[[DFNSTU]]'
+  ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $host_os in
+mingw*)
+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
+  symcode='[[ABCDGISTW]]'
+fi
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Write the raw and C identifiers.
+lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ 	]]\($symcode$symcode*\)[[ 	]][[ 	]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+  rm -f conftest*
+  cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+  if AC_TRY_EVAL(ac_compile); then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if egrep ' nm_test_var$' "$nlist" >/dev/null; then
+	if egrep ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext'
+
+	  cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr address;
+}
+lt_preloaded_symbols[[]] =
+{
+EOF
+	  sed "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext
+	  cat <<\EOF >> conftest.$ac_ext
+  {0, (lt_ptr) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  save_LIBS="$LIBS"
+	  save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$no_builtin_flag"
+	  if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then
+	    pipe_works=yes
+	  fi
+	  LIBS="$save_LIBS"
+	  CFLAGS="$save_CFLAGS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&AC_FD_CC
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&AC_FD_CC
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC
+    fi
+  else
+    echo "$progname: failed program was:" >&AC_FD_CC
+    cat conftest.$ac_ext >&5
+  fi
+  rm -f conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+])
+global_symbol_pipe="$lt_cv_sys_global_symbol_pipe"
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  global_symbol_to_cdecl=
+  global_symbol_to_c_name_address=
+else
+  global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl"
+  global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address"
+fi
+if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address";
+then
+  AC_MSG_RESULT(failed)
+else
+  AC_MSG_RESULT(ok)
+fi
+]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+
+# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
+# ---------------------------------
+AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR],
+[# Find the correct PATH separator.  Usually this is `:', but
+# DJGPP uses `;' like DOS.
+if test "X${PATH_SEPARATOR+set}" != Xset; then
+  UNAME=${UNAME-`uname 2>/dev/null`}
+  case X$UNAME in
+    *-DOS) lt_cv_sys_path_separator=';' ;;
+    *)     lt_cv_sys_path_separator=':' ;;
+  esac
+  PATH_SEPARATOR=$lt_cv_sys_path_separator
+fi
+])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
+
+# _LT_AC_PROG_ECHO_BACKSLASH
+# --------------------------
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
+AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
+[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+			      [AC_DIVERT_PUSH(NOTICE)])
+_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+  ;;
+esac
+
+echo=${ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X[$]1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
+fi
+
+if test "X[$]1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+  for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+    if (echo_test_string="`eval $cmd`") 2>/dev/null &&
+       echo_test_string="`eval $cmd`" &&
+       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+    then
+      break
+    fi
+  done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+   test "X$echo_testing_string" = "X$echo_test_string"; then
+  :
+else
+  # The Solaris, AIX, and Digital Unix default echo programs unquote
+  # backslashes.  This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  #
+  # So, first we look for a working echo in the user's PATH.
+
+  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for dir in $PATH /usr/ucb; do
+    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      echo="$dir/echo"
+      break
+    fi
+  done
+  IFS="$save_ifs"
+
+  if test "X$echo" = Xecho; then
+    # We didn't find a better echo, so look for alternatives.
+    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      # This shell has a builtin print -r that does the trick.
+      echo='print -r'
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+	 test "X$CONFIG_SHELL" != X/bin/ksh; then
+      # If we have ksh, try running configure again with it.
+      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+      export ORIGINAL_CONFIG_SHELL
+      CONFIG_SHELL=/bin/ksh
+      export CONFIG_SHELL
+      exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+    else
+      # Try using printf.
+      echo='printf %s\n'
+      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+	 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+	 test "X$echo_testing_string" = "X$echo_test_string"; then
+	# Cool, printf works
+	:
+      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	export CONFIG_SHELL
+	SHELL="$CONFIG_SHELL"
+	export SHELL
+	echo="$CONFIG_SHELL [$]0 --fallback-echo"
+      elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	echo="$CONFIG_SHELL [$]0 --fallback-echo"
+      else
+	# maybe with a smaller string...
+	prev=:
+
+	for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+	  if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+	  then
+	    break
+	  fi
+	  prev="$cmd"
+	done
+
+	if test "$prev" != 'sed 50q "[$]0"'; then
+	  echo_test_string=`eval $prev`
+	  export echo_test_string
+	  exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+	else
+	  # Oops.  We lost completely, so just stick with echo.
+	  echo=echo
+	fi
+      fi
+    fi
+  fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+   ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(ECHO)
+AC_DIVERT_POP
+])# _LT_AC_PROG_ECHO_BACKSLASH
+
+# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+#                           ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ------------------------------------------------------------------
+AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
+[if test "$cross_compiling" = yes; then :
+  [$4]
+else
+  AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+[#line __oline__ "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}]
+EOF
+  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) $1 ;;
+      x$lt_dlneed_uscore) $2 ;;
+      x$lt_unknown|x*) $3 ;;
+    esac
+  else :
+    # compilation failed
+    $3
+  fi
+fi
+rm -fr conftest*
+])# _LT_AC_TRY_DLOPEN_SELF
+
+# AC_LIBTOOL_DLOPEN_SELF
+# -------------------
+AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
+[if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  *)
+    AC_CHECK_FUNC([shl_load],
+          [lt_cv_dlopen="shl_load"],
+      [AC_CHECK_LIB([dld], [shl_load],
+            [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
+	[AC_CHECK_FUNC([dlopen],
+	      [lt_cv_dlopen="dlopen"],
+	  [AC_CHECK_LIB([dl], [dlopen],
+	        [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+	    [AC_CHECK_LIB([svld], [dlopen],
+	          [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+	      [AC_CHECK_LIB([dld], [dld_link],
+	            [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
+	      ])
+	    ])
+	  ])
+	])
+      ])
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    AC_CACHE_CHECK([whether a program can dlopen itself],
+	  lt_cv_dlopen_self, [dnl
+	  _LT_AC_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+    ])
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      LDFLAGS="$LDFLAGS $link_static_flag"
+      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+    	  lt_cv_dlopen_self_static, [dnl
+	  _LT_AC_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+	    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+      ])
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+])# AC_LIBTOOL_DLOPEN_SELF
+
+AC_DEFUN([_LT_AC_LTCONFIG_HACK],
+[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])dnl
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e s/^X//'
+sed_quote_subst='s/\([[\\"\\`$\\\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([[\\"\\`\\\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+need_locks="$enable_libtool_lock"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+if test x"$host" != x"$build"; then
+  ac_tool_prefix=${host_alias}-
+else
+  ac_tool_prefix=
+fi
+
+# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+case $host_os in
+linux-gnu*) ;;
+linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+esac
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds"
+    ;;
+  *)
+    old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+# Allow CC to be a program name with arguments.
+set dummy $CC
+compiler="[$]2"
+
+AC_MSG_CHECKING([for objdir])
+rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+AC_MSG_RESULT($objdir)
+
+
+AC_ARG_WITH(pic,
+[  --with-pic              try to use only PIC/non-PIC objects [default=use both]],
+pic_mode="$withval", pic_mode=default)
+test -z "$pic_mode" && pic_mode=default
+
+# We assume here that the value for lt_cv_prog_cc_pic will not be cached
+# in isolation, and that seeing it set (from the cache) indicates that
+# the associated values are set (in the cache) correctly too.
+AC_MSG_CHECKING([for $compiler option to produce PIC])
+AC_CACHE_VAL(lt_cv_prog_cc_pic,
+[ lt_cv_prog_cc_pic=
+  lt_cv_prog_cc_shlib=
+  lt_cv_prog_cc_wl=
+  lt_cv_prog_cc_static=
+  lt_cv_prog_cc_no_builtin=
+  lt_cv_prog_cc_can_build_shared=$can_build_shared
+
+  if test "$GCC" = yes; then
+    lt_cv_prog_cc_wl='-Wl,'
+    lt_cv_prog_cc_static='-static'
+
+    case $host_os in
+    aix*)
+      # Below there is a dirty hack to force normal static linking with -ldl
+      # The problem is because libdl dynamically linked with both libc and
+      # libC (AIX C++ library), which obviously doesn't included in libraries
+      # list by gcc. This cause undefined symbols with -static flags.
+      # This hack allows C programs to be linked with "-static -ldl", but
+      # not sure about C++ programs.
+      lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC"
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_cv_prog_cc_pic='-fno-common'
+      ;;
+    cygwin* | mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_cv_prog_cc_pic='-DDLL_EXPORT'
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	 lt_cv_prog_cc_pic=-Kconform_pic
+      fi
+      ;;
+    *)
+      lt_cv_prog_cc_pic='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for PIC flags for the system compiler.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      lt_cv_prog_cc_wl='-Wl,'
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_cv_prog_cc_static='-Bstatic'
+      else
+	lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      # Is there a better lt_cv_prog_cc_static that works with the bundled CC?
+      lt_cv_prog_cc_wl='-Wl,'
+      lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive"
+      lt_cv_prog_cc_pic='+Z'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_cv_prog_cc_wl='-Wl,'
+      lt_cv_prog_cc_static='-non_shared'
+      # PIC (with -KPIC) is the default.
+      ;;
+
+    cygwin* | mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_cv_prog_cc_pic='-DDLL_EXPORT'
+      ;;
+
+    newsos6)
+      lt_cv_prog_cc_pic='-KPIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      # All OSF/1 code is PIC.
+      lt_cv_prog_cc_wl='-Wl,'
+      lt_cv_prog_cc_static='-non_shared'
+      ;;
+
+    sco3.2v5*)
+      lt_cv_prog_cc_pic='-Kpic'
+      lt_cv_prog_cc_static='-dn'
+      lt_cv_prog_cc_shlib='-belf'
+      ;;
+
+    solaris*)
+      lt_cv_prog_cc_pic='-KPIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      lt_cv_prog_cc_wl='-Wl,'
+      ;;
+
+    sunos4*)
+      lt_cv_prog_cc_pic='-PIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      lt_cv_prog_cc_wl='-Qoption ld '
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+      lt_cv_prog_cc_pic='-KPIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      lt_cv_prog_cc_wl='-Wl,'
+      ;;
+
+    uts4*)
+      lt_cv_prog_cc_pic='-pic'
+      lt_cv_prog_cc_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_cv_prog_cc_pic='-Kconform_pic'
+	lt_cv_prog_cc_static='-Bstatic'
+      fi
+      ;;
+
+    *)
+      lt_cv_prog_cc_can_build_shared=no
+      ;;
+    esac
+  fi
+])
+if test -z "$lt_cv_prog_cc_pic"; then
+  AC_MSG_RESULT([none])
+else
+  AC_MSG_RESULT([$lt_cv_prog_cc_pic])
+
+  # Check to make sure the pic_flag actually works.
+  AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works])
+  AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl
+    save_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC"
+    AC_TRY_COMPILE([], [], [dnl
+      case $host_os in
+      hpux9* | hpux10* | hpux11*)
+	# On HP-UX, both CC and GCC only warn that PIC is supported... then
+	# they create non-PIC objects.  So, if there were any warnings, we
+	# assume that PIC is not supported.
+	if test -s conftest.err; then
+	  lt_cv_prog_cc_pic_works=no
+	else
+	  lt_cv_prog_cc_pic_works=yes
+	fi
+	;;
+      *)
+	lt_cv_prog_cc_pic_works=yes
+	;;
+      esac
+    ], [dnl
+      lt_cv_prog_cc_pic_works=no
+    ])
+    CFLAGS="$save_CFLAGS"
+  ])
+
+  if test "X$lt_cv_prog_cc_pic_works" = Xno; then
+    lt_cv_prog_cc_pic=
+    lt_cv_prog_cc_can_build_shared=no
+  else
+    lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic"
+  fi
+
+  AC_MSG_RESULT([$lt_cv_prog_cc_pic_works])
+fi
+
+# Check for any special shared library compilation flags.
+if test -n "$lt_cv_prog_cc_shlib"; then
+  AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries])
+  if echo "$old_CC $old_CFLAGS " | egrep -e "[[ 	]]$lt_cv_prog_cc_shlib[[ 	]]" >/dev/null; then :
+  else
+   AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure])
+    lt_cv_prog_cc_can_build_shared=no
+  fi
+fi
+
+AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works])
+AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl
+  lt_cv_prog_cc_static_works=no
+  save_LDFLAGS="$LDFLAGS"
+  LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static"
+  AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes])
+  LDFLAGS="$save_LDFLAGS"
+])
+
+# Belt *and* braces to stop my trousers falling down:
+test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static=
+AC_MSG_RESULT([$lt_cv_prog_cc_static_works])
+
+pic_flag="$lt_cv_prog_cc_pic"
+special_shlib_compile_flags="$lt_cv_prog_cc_shlib"
+wl="$lt_cv_prog_cc_wl"
+link_static_flag="$lt_cv_prog_cc_static"
+no_builtin_flag="$lt_cv_prog_cc_no_builtin"
+can_build_shared="$lt_cv_prog_cc_can_build_shared"
+
+
+# Check to see if options -o and -c are simultaneously supported by compiler
+AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext])
+AC_CACHE_VAL([lt_cv_compiler_c_o], [
+$rm -r conftest 2>/dev/null
+mkdir conftest
+cd conftest
+echo "int some_variable = 0;" > conftest.$ac_ext
+mkdir out
+# According to Tom Tromey, Ian Lance Taylor reported there are C compilers
+# that will create temporary files in the current directory regardless of
+# the output directory.  Thus, making CWD read-only will cause this test
+# to fail, enabling locking or at least warning the user not to do parallel
+# builds.
+chmod -w .
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
+compiler_c_o=no
+if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
+  # The compiler can only warn and ignore the option if not recognized
+  # So say no if there are warnings
+  if test -s out/conftest.err; then
+    lt_cv_compiler_c_o=no
+  else
+    lt_cv_compiler_c_o=yes
+  fi
+else
+  # Append any errors to the config.log.
+  cat out/conftest.err 1>&AC_FD_CC
+  lt_cv_compiler_c_o=no
+fi
+CFLAGS="$save_CFLAGS"
+chmod u+w .
+$rm conftest* out/*
+rmdir out
+cd ..
+rmdir conftest
+$rm -r conftest 2>/dev/null
+])
+compiler_c_o=$lt_cv_compiler_c_o
+AC_MSG_RESULT([$compiler_c_o])
+
+if test x"$compiler_c_o" = x"yes"; then
+  # Check to see if we can write to a .lo
+  AC_MSG_CHECKING([if $compiler supports -c -o file.lo])
+  AC_CACHE_VAL([lt_cv_compiler_o_lo], [
+  lt_cv_compiler_o_lo=no
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -c -o conftest.lo"
+  save_objext="$ac_objext"
+  ac_objext=lo
+  AC_TRY_COMPILE([], [int some_variable = 0;], [dnl
+    # The compiler can only warn and ignore the option if not recognized
+    # So say no if there are warnings
+    if test -s conftest.err; then
+      lt_cv_compiler_o_lo=no
+    else
+      lt_cv_compiler_o_lo=yes
+    fi
+  ])
+  ac_objext="$save_objext"
+  CFLAGS="$save_CFLAGS"
+  ])
+  compiler_o_lo=$lt_cv_compiler_o_lo
+  AC_MSG_RESULT([$compiler_o_lo])
+else
+  compiler_o_lo=no
+fi
+
+# Check to see if we can do hard links to lock some files if needed
+hard_links="nottested"
+if test "$compiler_c_o" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  AC_MSG_CHECKING([if we can lock with hard links])
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  AC_MSG_RESULT([$hard_links])
+  if test "$hard_links" = no; then
+    AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe])
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+if test "$GCC" = yes; then
+  # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
+  AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions])
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext"
+  compiler_rtti_exceptions=no
+  AC_TRY_COMPILE([], [int some_variable = 0;], [dnl
+    # The compiler can only warn and ignore the option if not recognized
+    # So say no if there are warnings
+    if test -s conftest.err; then
+      compiler_rtti_exceptions=no
+    else
+      compiler_rtti_exceptions=yes
+    fi
+  ])
+  CFLAGS="$save_CFLAGS"
+  AC_MSG_RESULT([$compiler_rtti_exceptions])
+
+  if test "$compiler_rtti_exceptions" = "yes"; then
+    no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
+  else
+    no_builtin_flag=' -fno-builtin'
+  fi
+fi
+
+# See if the linker supports building shared libraries.
+AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries])
+
+allow_undefined_flag=
+no_undefined_flag=
+need_lib_prefix=unknown
+need_version=unknown
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+archive_cmds=
+archive_expsym_cmds=
+old_archive_from_new_cmds=
+old_archive_from_expsyms_cmds=
+export_dynamic_flag_spec=
+whole_archive_flag_spec=
+thread_safe_flag_spec=
+hardcode_into_libs=no
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+hardcode_shlibpath_var=unsupported
+runpath_var=
+link_all_deplibs=unknown
+always_export_symbols=no
+export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
+# include_expsyms should be a list of space-separated symbols to be *always*
+# included in the symbol list
+include_expsyms=
+# exclude_expsyms can be an egrep regular expression of symbols to exclude
+# it will be wrapped by ` (' and `)$', so one must not match beginning or
+# end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+# as well as any symbol that contains `d'.
+exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+# platforms (ab)use it in PIC code, but their linkers get confused if
+# the symbol is explicitly referenced.  Since portable code cannot
+# rely on this symbol name, it's probably fine to never include it in
+# preloaded symbol tables.
+extract_expsyms_cmds=
+
+case $host_os in
+cygwin* | mingw* | pw32*)
+  # FIXME: the MSVC++ port hasn't been tested in a loooong time
+  # When not using gcc, we currently assume that we are using
+  # Microsoft Visual C++.
+  if test "$GCC" != yes; then
+    with_gnu_ld=no
+  fi
+  ;;
+openbsd*)
+  with_gnu_ld=no
+  ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+  # If archive_cmds runs LD, not CC, wlarc should be empty
+  wlarc='${wl}'
+
+  # See if GNU ld supports shared libraries.
+  case $host_os in
+  aix3* | aix4* | aix5*)
+    # On AIX, the GNU linker is very broken
+    # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available.
+    ld_shlibs=no
+    cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+    ;;
+
+  amigaos*)
+    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+
+    # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+    # that the semantics of dynamic libraries on AmigaOS, at least up
+    # to version 4, is to share data among multiple programs linked
+    # with the same dynamic library.  Since this doesn't match the
+    # behavior of shared libraries on other platforms, we can use
+    # them.
+    ld_shlibs=no
+    ;;
+
+  beos*)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      allow_undefined_flag=unsupported
+      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+      # support --undefined.  This deserves some investigation.  FIXME
+      archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # hardcode_libdir_flag_spec is actually meaningless, as there is
+    # no search path for DLLs.
+    hardcode_libdir_flag_spec='-L$libdir'
+    allow_undefined_flag=unsupported
+    always_export_symbols=yes
+
+    extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
+      sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~
+      test -f $output_objdir/impgen.exe || (cd $output_objdir && \
+      if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
+      else $CC -o impgen impgen.c ; fi)~
+      $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
+
+    old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
+
+    # cygwin and mingw dlls have different entry points and sets of symbols
+    # to exclude.
+    # FIXME: what about values for MSVC?
+    dll_entry=__cygwin_dll_entry@12
+    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
+    case $host_os in
+    mingw*)
+      # mingw values
+      dll_entry=_DllMainCRTStartup@12
+      dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
+      ;;
+    esac
+
+    # mingw and cygwin differ, and it's simplest to just exclude the union
+    # of the two symbol sets.
+    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
+
+    # recent cygwin and mingw systems supply a stub DllMain which the user
+    # can override, but on older systems we have to supply one (in ltdll.c)
+    if test "x$lt_cv_need_dllmain" = "xyes"; then
+      ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext "
+      ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~
+	test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
+    else
+      ltdll_obj=
+      ltdll_cmds=
+    fi
+
+    # Extract the symbol export list from an `--export-all' def file,
+    # then regenerate the def file from the symbol export list, so that
+    # the compiled dll only exports the symbol export list.
+    # Be careful not to strip the DATA tag left be newer dlltools.
+    export_symbols_cmds="$ltdll_cmds"'
+      $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
+      sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols'
+
+    # If the export-symbols file already is a .def file (1st line
+    # is EXPORTS), use it as is.
+    # If DATA tags from a recent dlltool are present, honour them!
+    archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then
+	cp $export_symbols $output_objdir/$soname-def;
+      else
+	echo EXPORTS > $output_objdir/$soname-def;
+	_lt_hint=1;
+	cat $export_symbols | while read symbol; do
+	 set dummy \$symbol;
+	 case \[$]# in
+	   2) echo "   \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
+	   4) echo "   \[$]2 \[$]3 \[$]4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;;
+	   *) echo "     \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;;
+	 esac;
+	 _lt_hint=`expr 1 + \$_lt_hint`;
+	done;
+      fi~
+      '"$ltdll_cmds"'
+      $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
+      $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~
+      $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
+    ;;
+
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+      wlarc=
+    else
+      archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    fi
+    ;;
+
+  solaris* | sysv5*)
+    if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
+      ld_shlibs=no
+      cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+    elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
+  sunos4*)
+    archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+    wlarc=
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  *)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+  esac
+
+  if test "$ld_shlibs" = yes; then
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    case $host_os in
+    cygwin* | mingw* | pw32*)
+      # dlltool doesn't understand --whole-archive et. al.
+      whole_archive_flag_spec=
+      ;;
+    *)
+      # ancient GNU ld didn't support --whole-archive et. al.
+      if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
+	whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+	whole_archive_flag_spec=
+      fi
+      ;;
+    esac
+  fi
+else
+  # PORTME fill in a description of your system's linker (not GNU ld)
+  case $host_os in
+  aix3*)
+    allow_undefined_flag=unsupported
+    always_export_symbols=yes
+    archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+    # Note: this linker hardcodes the directories in LIBPATH if there
+    # are no directories specified by -L.
+    hardcode_minus_L=yes
+    if test "$GCC" = yes && test -z "$link_static_flag"; then
+      # Neither direct hardcoding nor static linking is supported with a
+      # broken collect2.
+      hardcode_direct=unsupported
+    fi
+    ;;
+
+  aix4* | aix5*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+	for ld_flag in $LDFLAGS; do
+	  case $ld_flag in
+	  *-brtl*)
+	    aix_use_runtimelinking=yes
+	    break
+	  ;;
+	  esac
+	done
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
+    # When large executables or shared objects are built, AIX ld can
+    # have problems creating the table of contents.  If linking a library
+    # or program results in "error TOC overflow" add -mminimal-toc to
+    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+    hardcode_direct=yes
+    archive_cmds=''
+    hardcode_libdir_separator=':'
+    if test "$GCC" = yes; then
+      case $host_os in aix4.[[012]]|aix4.[[012]].*)
+	collect2name=`${CC} -print-prog-name=collect2`
+	if test -f "$collect2name" && \
+	  strings "$collect2name" | grep resolve_lib_name >/dev/null
+	then
+	  # We have reworked collect2
+	  hardcode_direct=yes
+	else
+	  # We have old collect2
+	  hardcode_direct=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  hardcode_minus_L=yes
+	  hardcode_libdir_flag_spec='-L$libdir'
+	  hardcode_libdir_separator=
+	fi
+      esac
+
+      shared_flag='-shared'
+    else
+      # not using gcc
+      if test "$host_cpu" = ia64; then
+	shared_flag='${wl}-G'
+      else
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag='${wl}-G'
+	else
+	  shared_flag='${wl}-bM:SRE'
+	fi
+      fi
+    fi
+
+    # It seems that -bexpall can do strange things, so it is better to
+    # generate a list of symbols to export.
+    always_export_symbols=yes
+    if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other runtime loading flags (-brtl),
+      # -berok will link without error, but may produce a broken library.
+      allow_undefined_flag='-berok'
+      hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
+      archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+    else
+      if test "$host_cpu" = ia64; then
+	hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+	allow_undefined_flag="-z nodefs"
+	archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+      else
+	hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib'
+	# Warning - without using the other run time loading flags,
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag='${wl}-berok'
+	# This is a bit strange, but is similar to how AIX traditionally builds
+	# it's shared libraries.
+	archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $output_objdir/$libname$release.a $output_objdir/$soname'
+      fi
+    fi
+    ;;
+
+  amigaos*)
+    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    # see comment about different semantics on the GNU ld section
+    ld_shlibs=no
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    # hardcode_libdir_flag_spec is actually meaningless, as there is
+    # no search path for DLLs.
+    hardcode_libdir_flag_spec=' '
+    allow_undefined_flag=unsupported
+    # Tell ltmain to make .lib files, not .a files.
+    libext=lib
+    # FIXME: Setting linknames here is a bad hack.
+    archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+    # The linker will automatically build a .lib file if we build a DLL.
+    old_archive_from_new_cmds='true'
+    # FIXME: Should let the user specify the lib program.
+    old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
+    fix_srcfile_path='`cygpath -w "$srcfile"`'
+    ;;
+
+  darwin* | rhapsody*)
+    case "$host_os" in
+    rhapsody* | darwin1.[[012]])
+      allow_undefined_flag='-undefined suppress'
+      ;;
+    *) # Darwin 1.3 on
+      allow_undefined_flag='-flat_namespace -undefined suppress'
+      ;;
+    esac
+    # FIXME: Relying on posixy $() will cause problems for
+    #        cross-compilation, but unfortunately the echo tests do not
+    #        yet detect zsh echo's removal of \ escapes.  Also zsh mangles
+    #	     `"' quotes if we put them in here... so don't!
+    archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)'
+    # We need to add '_' to the symbols in $export_symbols first
+    #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    whole_archive_flag_spec='-all_load $convenience'
+    ;;
+
+  freebsd1*)
+    ld_shlibs=no
+    ;;
+
+  # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+  # support.  Future versions do this automatically, but an explicit c++rt0.o
+  # does not break anything, and helps significantly (at the cost of a little
+  # extra space).
+  freebsd2.2*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+  freebsd2*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+  freebsd*)
+    archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  hpux9* | hpux10* | hpux11*)
+    case $host_os in
+    hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
+    *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
+    esac
+    hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+    hardcode_libdir_separator=:
+    hardcode_direct=yes
+    hardcode_minus_L=yes # Not in the search PATH, but as the default
+			 # location of the library.
+    export_dynamic_flag_spec='${wl}-E'
+    ;;
+
+  irix5* | irix6* | nonstopux*)
+    if test "$GCC" = yes; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    else
+      archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='-rpath $libdir'
+    fi
+    hardcode_libdir_separator=:
+    link_all_deplibs=yes
+    ;;
+
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+    else
+      archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+    fi
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  newsos6)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    hardcode_shlibpath_var=no
+    ;;
+
+  openbsd*)
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec='${wl}-E'
+    else
+      case "$host_os" in
+      openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_libdir_flag_spec='-R$libdir'
+        ;;
+      *)
+        archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+        hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+        ;;
+      esac
+    fi
+    ;;
+
+  os2*)
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    allow_undefined_flag=unsupported
+    archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+    old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+    ;;
+
+  osf3*)
+    if test "$GCC" = yes; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+    else
+      allow_undefined_flag=' -expect_unresolved \*'
+      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+    fi
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    ;;
+
+  osf4* | osf5*)	# as osf3* with the addition of -msym flag
+    if test "$GCC" = yes; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    else
+      allow_undefined_flag=' -expect_unresolved \*'
+      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+      $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
+
+      #Both c and cxx compiler support -rpath directly
+      hardcode_libdir_flag_spec='-rpath $libdir'
+    fi
+    hardcode_libdir_separator=:
+    ;;
+
+  sco3.2v5*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_shlibpath_var=no
+    runpath_var=LD_RUN_PATH
+    hardcode_runpath_var=yes
+    export_dynamic_flag_spec='${wl}-Bexport'
+    ;;
+
+  solaris*)
+    # gcc --version < 3.0 without binutils cannot create self contained
+    # shared libraries reliably, requiring libgcc.a to resolve some of
+    # the object symbols generated in some cases.  Libraries that use
+    # assert need libgcc.a to resolve __eprintf, for example.  Linking
+    # a copy of libgcc.a into every shared library to guarantee resolving
+    # such symbols causes other problems:  According to Tim Van Holder
+    # <tim.van.holder@pandora.be>, C++ libraries end up with a separate
+    # (to the application) exception stack for one thing.
+    no_undefined_flag=' -z defs'
+    if test "$GCC" = yes; then
+      case `$CC --version 2>/dev/null` in
+      [[12]].*)
+	cat <<EOF 1>&2
+
+*** Warning: Releases of GCC earlier than version 3.0 cannot reliably
+*** create self contained shared libraries on Solaris systems, without
+*** introducing a dependency on libgcc.a.  Therefore, libtool is disabling
+*** -no-undefined support, which will at least allow you to build shared
+*** libraries.  However, you may find that when you link such libraries
+*** into an application without using GCC, you have to manually add
+*** \`gcc --print-libgcc-file-name\` to the link command.  We urge you to
+*** upgrade to a newer version of GCC.  Another option is to rebuild your
+*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer.
+
+EOF
+        no_undefined_flag=
+	;;
+      esac
+    fi
+    # $CC -shared without GNU ld will not create a library from C++
+    # object files and a static libstdc++, better avoid it by now
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_shlibpath_var=no
+    case $host_os in
+    solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+    *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+      whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+    esac
+    link_all_deplibs=yes
+    ;;
+
+  sunos4*)
+    if test "x$host_vendor" = xsequent; then
+      # Use $CC to link under sequent, because it throws in some extra .o
+      # files that make .init and .fini sections work.
+      archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+    else
+      archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+    fi
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4)
+    case $host_vendor in
+      sni)
+        archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+        hardcode_direct=yes # is this really true???
+        ;;
+      siemens)
+        ## LD is ld it makes a PLAMLIB
+        ## CC just makes a GrossModule.
+        archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+        reload_cmds='$CC -r -o $output$reload_objs'
+        hardcode_direct=no
+        ;;
+      motorola)
+        archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+        hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+        ;;
+    esac
+    runpath_var='LD_RUN_PATH'
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4.3*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_shlibpath_var=no
+    export_dynamic_flag_spec='-Bexport'
+    ;;
+
+  sysv5*)
+    no_undefined_flag=' -z text'
+    # $CC -shared without GNU ld will not create a library from C++
+    # object files and a static libstdc++, better avoid it by now
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+    hardcode_libdir_flag_spec=
+    hardcode_shlibpath_var=no
+    runpath_var='LD_RUN_PATH'
+    ;;
+
+  uts4*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_shlibpath_var=no
+    ;;
+
+  dgux*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4*MP*)
+    if test -d /usr/nec; then
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      runpath_var=LD_RUN_PATH
+      hardcode_runpath_var=yes
+      ld_shlibs=yes
+    fi
+    ;;
+
+  sysv4.2uw2*)
+    archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_minus_L=no
+    hardcode_shlibpath_var=no
+    hardcode_runpath_var=yes
+    runpath_var=LD_RUN_PATH
+    ;;
+
+  sysv5uw7* | unixware7*)
+    no_undefined_flag='${wl}-z ${wl}text'
+    if test "$GCC" = yes; then
+      archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+    else
+      archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+    fi
+    runpath_var='LD_RUN_PATH'
+    hardcode_shlibpath_var=no
+    ;;
+
+  *)
+    ld_shlibs=no
+    ;;
+  esac
+fi
+AC_MSG_RESULT([$ld_shlibs])
+test "$ld_shlibs" = no && can_build_shared=no
+
+# Check hardcoding attributes.
+AC_MSG_CHECKING([how to hardcode library paths into programs])
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+   test -n "$runpath_var"; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$hardcode_shlibpath_var" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+AC_MSG_RESULT([$hardcode_action])
+
+striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  AC_MSG_RESULT([yes])
+else
+  AC_MSG_RESULT([no])
+fi
+
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+# PORTME Fill in your ld.so characteristics
+AC_MSG_CHECKING([dynamic linker characteristics])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}.so$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[[01]] | aix4.[[01]].*)
+	if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	     echo ' yes '
+	     echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	  :
+	else
+	  can_build_shared=no
+	fi
+	;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can
+    # not hardcode correct soname into executable. Probably we can
+    # add versioning support to collect2, so additional links can
+    # be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}.so$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  hardcode_into_libs=yes
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}.so'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi4*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  export_dynamic_flag_spec=-rdynamic
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  need_version=no
+  need_lib_prefix=no
+  case $GCC,$host_os in
+  yes,cygwin*)
+    library_names_spec='$libname.dll.a'
+    soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll'
+    postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog .libs/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    ;;
+  yes,mingw*)
+    library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll'
+    sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"`
+    ;;
+  yes,pw32*)
+    library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
+    ;;
+  *)
+    library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  # FIXME: Relying on posixy $() will cause problems for
+  #        cross-compilation, but unfortunately the echo tests do not
+  #        yet detect zsh echo's removal of \ escapes.
+  library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)'
+  soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd*-gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU/FreeBSD ld.so'
+  ;;
+
+freebsd*)
+  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  *)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  dynamic_linker="$host_os dld.sl"
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  shlibpath_var=SHLIB_PATH
+  shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+  library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl'
+  soname_spec='${libname}${release}.sl$major'
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)          version_type=irix ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
+    soname_spec='${libname}${release}.so$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case "$host_os" in
+    openbsd2.[[89]] | openbsd2.[[89]].*)
+      shlibpath_overrides_runpath=no
+      ;;
+    *)
+      shlibpath_overrides_runpath=yes
+      ;;
+    esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+os2*)
+  libname_spec='$name'
+  need_lib_prefix=no
+  library_names_spec='$libname.dll $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_version=no
+  need_lib_prefix=no
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  hardcode_into_libs=yes
+  ;;
+
+sco3.2v5*)
+  version_type=osf
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
+    soname_spec='$libname.so.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+# Report the final consequences.
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+
+aix4*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+  ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+if test "$hardcode_action" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+AC_LIBTOOL_DLOPEN_SELF
+
+if test "$enable_shared" = yes && test "$GCC" = yes; then
+  case $archive_cmds in
+  *'~'*)
+    # FIXME: we may have to deal with multi-command sequences.
+    ;;
+  '$CC '*)
+    # Test whether the compiler implicitly links with -lc since on some
+    # systems, -lgcc has to come before -lc. If gcc already passes -lc
+    # to ld, don't add -lc before -lgcc.
+    AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+    AC_CACHE_VAL([lt_cv_archive_cmds_need_lc],
+    [$rm conftest*
+    echo 'static int dummy;' > conftest.$ac_ext
+
+    if AC_TRY_EVAL(ac_compile); then
+      soname=conftest
+      lib=conftest
+      libobjs=conftest.$ac_objext
+      deplibs=
+      wl=$lt_cv_prog_cc_wl
+      compiler_flags=-v
+      linker_flags=-v
+      verstring=
+      output_objdir=.
+      libname=conftest
+      save_allow_undefined_flag=$allow_undefined_flag
+      allow_undefined_flag=
+      if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1)
+      then
+	lt_cv_archive_cmds_need_lc=no
+      else
+	lt_cv_archive_cmds_need_lc=yes
+      fi
+      allow_undefined_flag=$save_allow_undefined_flag
+    else
+      cat conftest.err 1>&5
+    fi])
+    AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc])
+    ;;
+  esac
+fi
+need_lc=${lt_cv_archive_cmds_need_lc-yes}
+
+# The second clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  :
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  test -f Makefile && make "$ltmain"
+fi
+
+if test -f "$ltmain"; then
+  trap "$rm \"${ofile}T\"; exit 1" 1 2 15
+  $rm -f "${ofile}T"
+
+  echo creating $ofile
+
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS SED \
+    AR AR_FLAGS CC LD LN_S NM SHELL \
+    reload_flag reload_cmds wl \
+    pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
+    thread_safe_flag_spec whole_archive_flag_spec libname_spec \
+    library_names_spec soname_spec \
+    RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
+    old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \
+    postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \
+    old_striplib striplib file_magic_cmd export_symbols_cmds \
+    deplibs_check_method allow_undefined_flag no_undefined_flag \
+    finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
+    global_symbol_to_c_name_address \
+    hardcode_libdir_flag_spec hardcode_libdir_separator  \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
+
+    case $var in
+    reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
+    extract_expsyms_cmds | old_archive_from_expsyms_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  cat <<__EOF__ > "${ofile}T"
+#! $SHELL
+
+# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996-2000 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="${SED} -e s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$need_lc
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# The default C compiler.
+CC=$lt_CC
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_wl
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_pic_flag
+pic_mode=$pic_mode
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_compiler_c_o
+
+# Can we write directly to a .lo ?
+compiler_o_lo=$lt_compiler_o_lo
+
+# Must we lock files when doing compilation ?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_link_static_flag
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# ### END LIBTOOL CONFIG
+
+__EOF__
+
+  case $host_os in
+  aix3*)
+    cat <<\EOF >> "${ofile}T"
+
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+EOF
+    ;;
+  esac
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | os2*)
+    cat <<'EOF' >> "${ofile}T"
+      # This is a source program that is used to create dlls on Windows
+      # Don't remove nor modify the starting and closing comments
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# #  ifdef __CYGWIN32__
+# #    define __CYGWIN__ __CYGWIN32__
+# #  endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+#   __hDllInstance_base = hInst;
+#   return TRUE;
+# }
+# /* ltdll.c ends here */
+	# This is a source program that is used to create import libraries
+	# on Windows for dlls which lack them. Don't remove nor modify the
+	# starting and closing comments
+# /* impgen.c starts here */
+# /*   Copyright (C) 1999-2000 Free Software Foundation, Inc.
+#
+#  This file is part of GNU libtool.
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#  */
+#
+# #include <stdio.h>		/* for printf() */
+# #include <unistd.h>		/* for open(), lseek(), read() */
+# #include <fcntl.h>		/* for O_RDONLY, O_BINARY */
+# #include <string.h>		/* for strdup() */
+#
+# /* O_BINARY isn't required (or even defined sometimes) under Unix */
+# #ifndef O_BINARY
+# #define O_BINARY 0
+# #endif
+#
+# static unsigned int
+# pe_get16 (fd, offset)
+#      int fd;
+#      int offset;
+# {
+#   unsigned char b[2];
+#   lseek (fd, offset, SEEK_SET);
+#   read (fd, b, 2);
+#   return b[0] + (b[1]<<8);
+# }
+#
+# static unsigned int
+# pe_get32 (fd, offset)
+#     int fd;
+#     int offset;
+# {
+#   unsigned char b[4];
+#   lseek (fd, offset, SEEK_SET);
+#   read (fd, b, 4);
+#   return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# static unsigned int
+# pe_as32 (ptr)
+#      void *ptr;
+# {
+#   unsigned char *b = ptr;
+#   return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# int
+# main (argc, argv)
+#     int argc;
+#     char *argv[];
+# {
+#     int dll;
+#     unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
+#     unsigned long export_rva, export_size, nsections, secptr, expptr;
+#     unsigned long name_rvas, nexp;
+#     unsigned char *expdata, *erva;
+#     char *filename, *dll_name;
+#
+#     filename = argv[1];
+#
+#     dll = open(filename, O_RDONLY|O_BINARY);
+#     if (dll < 1)
+# 	return 1;
+#
+#     dll_name = filename;
+#
+#     for (i=0; filename[i]; i++)
+# 	if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
+# 	    dll_name = filename + i +1;
+#
+#     pe_header_offset = pe_get32 (dll, 0x3c);
+#     opthdr_ofs = pe_header_offset + 4 + 20;
+#     num_entries = pe_get32 (dll, opthdr_ofs + 92);
+#
+#     if (num_entries < 1) /* no exports */
+# 	return 1;
+#
+#     export_rva = pe_get32 (dll, opthdr_ofs + 96);
+#     export_size = pe_get32 (dll, opthdr_ofs + 100);
+#     nsections = pe_get16 (dll, pe_header_offset + 4 +2);
+#     secptr = (pe_header_offset + 4 + 20 +
+# 	      pe_get16 (dll, pe_header_offset + 4 + 16));
+#
+#     expptr = 0;
+#     for (i = 0; i < nsections; i++)
+#     {
+# 	char sname[8];
+# 	unsigned long secptr1 = secptr + 40 * i;
+# 	unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
+# 	unsigned long vsize = pe_get32 (dll, secptr1 + 16);
+# 	unsigned long fptr = pe_get32 (dll, secptr1 + 20);
+# 	lseek(dll, secptr1, SEEK_SET);
+# 	read(dll, sname, 8);
+# 	if (vaddr <= export_rva && vaddr+vsize > export_rva)
+# 	{
+# 	    expptr = fptr + (export_rva - vaddr);
+# 	    if (export_rva + export_size > vaddr + vsize)
+# 		export_size = vsize - (export_rva - vaddr);
+# 	    break;
+# 	}
+#     }
+#
+#     expdata = (unsigned char*)malloc(export_size);
+#     lseek (dll, expptr, SEEK_SET);
+#     read (dll, expdata, export_size);
+#     erva = expdata - export_rva;
+#
+#     nexp = pe_as32 (expdata+24);
+#     name_rvas = pe_as32 (expdata+32);
+#
+#     printf ("EXPORTS\n");
+#     for (i = 0; i<nexp; i++)
+#     {
+# 	unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
+# 	printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
+#     }
+#
+#     return 0;
+# }
+# /* impgen.c ends here */
+
+EOF
+    ;;
+  esac
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "${ofile}T" || (rm -f "${ofile}T"; exit 1)
+
+  mv -f "${ofile}T" "$ofile" || \
+    (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T")
+  chmod +x "$ofile"
+fi
+
+])# _LT_AC_LTCONFIG_HACK
+
+# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
+AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
+
+# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
+AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
+
+# AC_ENABLE_SHARED - implement the --enable-shared flag
+# Usage: AC_ENABLE_SHARED[(DEFAULT)]
+#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
+#   `yes'.
+AC_DEFUN([AC_ENABLE_SHARED],
+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(shared,
+changequote(<<, >>)dnl
+<<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+  enable_shared=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_shared=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac],
+enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
+])
+
+# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
+AC_DEFUN([AC_DISABLE_SHARED],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)])
+
+# AC_ENABLE_STATIC - implement the --enable-static flag
+# Usage: AC_ENABLE_STATIC[(DEFAULT)]
+#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
+#   `yes'.
+AC_DEFUN([AC_ENABLE_STATIC],
+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(static,
+changequote(<<, >>)dnl
+<<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+  enable_static=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_static=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac],
+enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
+])
+
+# AC_DISABLE_STATIC - set the default static flag to --disable-static
+AC_DEFUN([AC_DISABLE_STATIC],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)])
+
+
+# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
+# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
+#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
+#   `yes'.
+AC_DEFUN([AC_ENABLE_FAST_INSTALL],
+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(fast-install,
+changequote(<<, >>)dnl
+<<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+  enable_fast_install=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_fast_install=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac],
+enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
+])
+
+# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install
+AC_DEFUN([AC_DISABLE_FAST_INSTALL],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)])
+
+# AC_LIBTOOL_PICMODE - implement the --with-pic flag
+# Usage: AC_LIBTOOL_PICMODE[(MODE)]
+#   Where MODE is either `yes' or `no'.  If omitted, it defaults to
+#   `both'.
+AC_DEFUN([AC_LIBTOOL_PICMODE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+pic_mode=ifelse($#,1,$1,default)])
+
+
+# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library
+AC_DEFUN([AC_PATH_TOOL_PREFIX],
+[AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+  /*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+  ?:/*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+  ;;
+  *)
+  ac_save_MAGIC_CMD="$MAGIC_CMD"
+  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="ifelse([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    egrep "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  MAGIC_CMD="$ac_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+])
+
+
+# AC_PATH_MAGIC - find a file program which can recognise a shared library
+AC_DEFUN([AC_PATH_MAGIC],
+[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl
+AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])
+
+
+# AC_PROG_LD - find the path to the GNU or non-GNU linker
+AC_DEFUN([AC_PROG_LD],
+[AC_ARG_WITH(gnu-ld,
+[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by GCC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | [[A-Za-z]]:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the path of ld
+      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some GNU ld's only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+	test "$with_gnu_ld" != no && break
+      else
+	test "$with_gnu_ld" != yes && break
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT($LD)
+else
+  AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])
+
+# AC_PROG_LD_GNU -
+AC_DEFUN([AC_PROG_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+  lt_cv_prog_gnu_ld=yes
+else
+  lt_cv_prog_gnu_ld=no
+fi])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])
+
+# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
+[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag,
+[lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+])
+
+# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
+[AC_CACHE_CHECK([how to recognise dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi4*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin* | mingw* | pw32*)
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  case "$host_os" in
+  rhapsody* | darwin1.[[012]])
+    lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1`
+    ;;
+  *) # Darwin 1.3 on
+    lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
+    ;;
+  esac
+  ;;
+
+freebsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20*|hpux11*)
+  lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libc.sl
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+  irix5* | nonstopux*)
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+    ;;
+  *)
+    case $LD in
+    *-32|*"-32 ") libmagic=32-bit;;
+    *-n32|*"-n32 ") libmagic=N32;;
+    *-64|*"-64 ") libmagic=64-bit;;
+    *) libmagic=never-match;;
+    esac
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1"
+    ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+  case $host_cpu in
+  alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64*)
+    lt_cv_deplibs_check_method=pass_all ;;
+  *)
+    # glibc up to 2.1.1 does not perform some relocations on ARM
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so\.[[0-9]]+\.[[0-9]]+$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+openbsd*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object'
+  else
+    lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  # this will be overridden with pass_all, but let us keep it just in case
+  lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sco3.2v5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  lt_cv_file_magic_test_file=/lib/libc.so
+  ;;
+
+sysv5uw[[78]]* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+])
+
+
+# AC_PROG_NM - find the path to a BSD-compatible name lister
+AC_DEFUN([AC_PROG_NM],
+[AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl
+AC_MSG_CHECKING([for BSD-compatible nm])
+AC_CACHE_VAL(lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+    test -z "$ac_dir" && ac_dir=.
+    tmp_nm=$ac_dir/${ac_tool_prefix}nm
+    if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
+      # Check to see if the nm accepts a BSD-compat flag.
+      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+      #   nm: unknown option "B" ignored
+      # Tru64's nm complains that /dev/null is an invalid object file
+      if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
+	lt_cv_path_NM="$tmp_nm -B"
+	break
+      elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+	lt_cv_path_NM="$tmp_nm -p"
+	break
+      else
+	lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	continue # so that we can try to find one that supports BSD flags
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi])
+NM="$lt_cv_path_NM"
+AC_MSG_RESULT([$NM])
+])
+
+# AC_CHECK_LIBM - check for math library
+AC_DEFUN([AC_CHECK_LIBM],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32*)
+  # These system don't have libm
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, main, LIBM="-lm")
+  ;;
+esac
+])
+
+# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl convenience library and LTDLINCL to the include flags for
+# the libltdl header and adds --enable-ltdl-convenience to the
+# configure arguments.  Note that LIBLTDL and LTDLINCL are not
+# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If DIR is not
+# provided, it is assumed to be `libltdl'.  LIBLTDL will be prefixed
+# with '${top_builddir}/' and LTDLINCL will be prefixed with
+# '${top_srcdir}/' (note the single quotes!).  If your package is not
+# flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  case $enable_ltdl_convenience in
+  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+  "") enable_ltdl_convenience=yes
+      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+  esac
+  LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+  LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
+])
+
+# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl installable library and LTDLINCL to the include flags for
+# the libltdl header and adds --enable-ltdl-install to the configure
+# arguments.  Note that LIBLTDL and LTDLINCL are not AC_SUBSTed, nor is
+# AC_CONFIG_SUBDIRS called.  If DIR is not provided and an installed
+# libltdl is not found, it is assumed to be `libltdl'.  LIBLTDL will
+# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed
+# with '${top_srcdir}/' (note the single quotes!).  If your package is
+# not flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  AC_CHECK_LIB(ltdl, main,
+  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+  [if test x"$enable_ltdl_install" = xno; then
+     AC_MSG_WARN([libltdl not installed, but installation disabled])
+   else
+     enable_ltdl_install=yes
+   fi
+  ])
+  if test x"$enable_ltdl_install" = x"yes"; then
+    ac_configure_args="$ac_configure_args --enable-ltdl-install"
+    LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+    LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  else
+    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+    LIBLTDL="-lltdl"
+    LTDLINCL=
+  fi
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
+])
+
+# old names
+AC_DEFUN([AM_PROG_LIBTOOL],   [AC_PROG_LIBTOOL])
+AC_DEFUN([AM_ENABLE_SHARED],  [AC_ENABLE_SHARED($@)])
+AC_DEFUN([AM_ENABLE_STATIC],  [AC_ENABLE_STATIC($@)])
+AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+AC_DEFUN([AM_PROG_LD],        [AC_PROG_LD])
+AC_DEFUN([AM_PROG_NM],        [AC_PROG_NM])
+
+# This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])
+
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+# LT_AC_PROG_SED
+# --------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+AC_DEFUN([LT_AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_executable_p="test -f"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+        _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+
+  # Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+: ${TMPDIR=/tmp}
+{
+  tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=$TMPDIR/sed$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in $TMPDIR" >&2
+   { (exit 1); exit 1; }
+}
+  _max=0
+  _count=0
+  # Add /usr/xpg4/bin/sed as it is typically found on Solaris
+  # along with /bin/sed that truncates output.
+  for _sed in $_sed_list /usr/xpg4/bin/sed; do
+    test ! -f ${_sed} && break
+    cat /dev/null > "$tmp/sed.in"
+    _count=0
+    echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in"
+    # Check for GNU sed and select it if it is found.
+    if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then
+      lt_cv_path_SED=${_sed}
+      break
+    fi
+    while true; do
+      cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp"
+      mv "$tmp/sed.tmp" "$tmp/sed.in"
+      cp "$tmp/sed.in" "$tmp/sed.nl"
+      echo >>"$tmp/sed.nl"
+      ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break
+      cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break
+      # 40000 chars as input seems more than enough
+      test $_count -gt 10 && break
+      _count=`expr $_count + 1`
+      if test $_count -gt $_max; then
+        _max=$_count
+        lt_cv_path_SED=$_sed
+      fi
+    done
+  done
+  rm -rf "$tmp"
+])
+if test "X$SED" != "X"; then
+  lt_cv_path_SED=$SED
+else
+  SED=$lt_cv_path_SED
+fi
+AC_MSG_RESULT([$SED])
+])
+
--- metamail-2.7.orig/configure
+++ metamail-2.7/configure
@@ -0,0 +1,7333 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13 
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+  --enable-maintainer-mode enable make rules and dependencies not useful
+                          (and sometimes confusing) to the casual installer"
+ac_help="$ac_help
+  --enable-shared[=PKGS]  build shared libraries [default=yes]"
+ac_help="$ac_help
+  --enable-static[=PKGS]  build static libraries [default=yes]"
+ac_help="$ac_help
+  --enable-fast-install[=PKGS]  optimize for fast installation [default=yes]"
+ac_help="$ac_help
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]"
+
+# Find the correct PATH separator.  Usually this is `:', but
+# DJGPP uses `;' like DOS.
+if test "X${PATH_SEPARATOR+set}" != Xset; then
+  UNAME=${UNAME-`uname 2>/dev/null`}
+  case X$UNAME in
+    *-DOS) lt_cv_sys_path_separator=';' ;;
+    *)     lt_cv_sys_path_separator=':' ;;
+  esac
+  PATH_SEPARATOR=$lt_cv_sys_path_separator
+fi
+
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','`
+  ;;
+esac
+
+echo=${ECHO-echo}
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+
+EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+  for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+    if (echo_test_string="`eval $cmd`") 2>/dev/null &&
+       echo_test_string="`eval $cmd`" &&
+       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+    then
+      break
+    fi
+  done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+   test "X$echo_testing_string" = "X$echo_test_string"; then
+  :
+else
+  # The Solaris, AIX, and Digital Unix default echo programs unquote
+  # backslashes.  This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  #
+  # So, first we look for a working echo in the user's PATH.
+
+  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for dir in $PATH /usr/ucb; do
+    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      echo="$dir/echo"
+      break
+    fi
+  done
+  IFS="$save_ifs"
+
+  if test "X$echo" = Xecho; then
+    # We didn't find a better echo, so look for alternatives.
+    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      # This shell has a builtin print -r that does the trick.
+      echo='print -r'
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+	 test "X$CONFIG_SHELL" != X/bin/ksh; then
+      # If we have ksh, try running configure again with it.
+      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+      export ORIGINAL_CONFIG_SHELL
+      CONFIG_SHELL=/bin/ksh
+      export CONFIG_SHELL
+      exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
+    else
+      # Try using printf.
+      echo='printf %s\n'
+      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+	 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+	 test "X$echo_testing_string" = "X$echo_test_string"; then
+	# Cool, printf works
+	:
+      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	export CONFIG_SHELL
+	SHELL="$CONFIG_SHELL"
+	export SHELL
+	echo="$CONFIG_SHELL $0 --fallback-echo"
+      elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	echo="$CONFIG_SHELL $0 --fallback-echo"
+      else
+	# maybe with a smaller string...
+	prev=:
+
+	for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+	  if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+	  then
+	    break
+	  fi
+	  prev="$cmd"
+	done
+
+	if test "$prev" != 'sed 50q "$0"'; then
+	  echo_test_string=`eval $prev`
+	  export echo_test_string
+	  exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
+	else
+	  # Oops.  We lost completely, so just stick with echo.
+	  echo=echo
+	fi
+      fi
+    fi
+  fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+   ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
+fi
+
+
+ac_help="$ac_help
+  --disable-libtool-lock  avoid locking (might break parallel builds)"
+ac_help="$ac_help
+  --with-pic              try to use only PIC/non-PIC objects [default=use both]"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval "$ac_prev=\$ac_option"
+    ac_prev=
+    continue
+  fi
+
+  case "$ac_option" in
+  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) ac_optarg= ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case "$ac_option" in
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir="$ac_optarg" ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build="$ac_optarg" ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file="$ac_optarg" ;;
+
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir="$ac_optarg" ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    eval "enable_${ac_feature}=no" ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix="$ac_optarg" ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he)
+    # Omit some internal or obsolete options to make the list less imposing.
+    # This message is too long to be a string in the A/UX 3.1 sh.
+    cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+  --cache-file=FILE       cache test results in FILE
+  --help                  print this message
+  --no-create             do not create output files
+  --quiet, --silent       do not print \`checking...' messages
+  --version               print the version of autoconf that created configure
+Directory and file names:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [same as prefix]
+  --bindir=DIR            user executables in DIR [EPREFIX/bin]
+  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
+  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
+  --datadir=DIR           read-only architecture-independent data in DIR
+                          [PREFIX/share]
+  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
+                          [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
+  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
+  --includedir=DIR        C header files in DIR [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
+  --infodir=DIR           info documentation in DIR [PREFIX/info]
+  --mandir=DIR            man documentation in DIR [PREFIX/man]
+  --srcdir=DIR            find the sources in DIR [configure dir or ..]
+  --program-prefix=PREFIX prepend PREFIX to installed program names
+  --program-suffix=SUFFIX append SUFFIX to installed program names
+  --program-transform-name=PROGRAM
+                          run sed PROGRAM on installed program names
+EOF
+    cat << EOF
+Host type:
+  --build=BUILD           configure for building on BUILD [BUILD=HOST]
+  --host=HOST             configure for HOST [guessed]
+  --target=TARGET         configure for TARGET [TARGET=HOST]
+Features and packages:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --x-includes=DIR        X include files are in DIR
+  --x-libraries=DIR       X library files are in DIR
+EOF
+    if test -n "$ac_help"; then
+      echo "--enable and --with options recognized:$ac_help"
+    fi
+    exit 0 ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host="$ac_optarg" ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir="$ac_optarg" ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir="$ac_optarg" ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir="$ac_optarg" ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir="$ac_optarg" ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    localstatedir="$ac_optarg" ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir="$ac_optarg" ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir="$ac_optarg" ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix="$ac_optarg" ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix="$ac_optarg" ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix="$ac_optarg" ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name="$ac_optarg" ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir="$ac_optarg" ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir="$ac_optarg" ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site="$ac_optarg" ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir="$ac_optarg" ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir="$ac_optarg" ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target="$ac_optarg" ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers)
+    echo "configure generated by autoconf version 2.13"
+    exit 0 ;;
+
+  -with-* | --with-*)
+    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_${ac_package}='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    eval "with_${ac_package}=no" ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes="$ac_optarg" ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries="$ac_optarg" ;;
+
+  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+    ;;
+
+  *)
+    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+      echo "configure: warning: $ac_option: invalid host type" 1>&2
+    fi
+    if test "x$nonopt" != xNONE; then
+      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+    fi
+    nonopt="$ac_option"
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+  exec 6>/dev/null
+else
+  exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+  case "$ac_arg" in
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c) ;;
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+  esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set.  These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=src/metamail/metamail.c
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then its parent.
+  ac_prog=$0
+  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+  srcdir=$ac_confdir
+  if test ! -r $srcdir/$ac_unique_file; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+  else
+    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+  fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    echo "loading site script $ac_site_file"
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  echo "loading cache $cache_file"
+  . $cache_file
+else
+  echo "creating cache $cache_file"
+  > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+    ac_n= ac_c='
+' ac_t='	'
+  else
+    ac_n=-n ac_c= ac_t=
+  fi
+else
+  ac_n= ac_c='\c' ac_t=
+fi
+
+
+ac_aux_dir=
+for ac_dir in config $srcdir/config; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { echo "configure: error: can not find install-sh or install.sh in config $srcdir/config" 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+
+
+
+am__api_version="1.4"
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:734: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS=":"
+  for ac_dir in $PATH; do
+    # Account for people who put trailing slashes in PATH elements.
+    case "$ac_dir/" in
+    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+    *)
+      # OSF1 and SCO ODT 3.0 have their own names for install.
+      # Don't use installbsd from OSF since it installs stuff as root
+      # by default.
+      for ac_prog in ginstall scoinst install; do
+        if test -f $ac_dir/$ac_prog; then
+	  if test $ac_prog = install &&
+            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  else
+	    ac_cv_path_install="$ac_dir/$ac_prog -c"
+	    break 2
+	  fi
+	fi
+      done
+      ;;
+    esac
+  done
+  IFS="$ac_save_IFS"
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL="$ac_cv_path_install"
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL="$ac_install_sh"
+  fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
+echo "configure:787: checking whether build environment is sane" >&5
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftestfile`
+   fi
+   if test "$*" != "X $srcdir/configure conftestfile" \
+      && test "$*" != "X conftestfile $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      { echo "configure: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" 1>&2; exit 1; }
+   fi
+
+   test "$2" = conftestfile
+   )
+then
+   # Ok.
+   :
+else
+   { echo "configure: error: newly created file is older than distributed files!
+Check your system clock" 1>&2; exit 1; }
+fi
+rm -f conftest*
+echo "$ac_t""yes" 1>&6
+if test "$program_transform_name" = s,x,x,; then
+  program_transform_name=
+else
+  # Double any \ or $.  echo might interpret backslashes.
+  cat <<\EOF_SED > conftestsed
+s,\\,\\\\,g; s,\$,$$,g
+EOF_SED
+  program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
+  rm -f conftestsed
+fi
+test "$program_prefix" != NONE &&
+  program_transform_name="s,^,${program_prefix},; $program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
+
+# sed with no file args requires a program.
+test "$program_transform_name" = "" && program_transform_name="s,x,x,"
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:844: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftestmake <<\EOF
+all:
+	@echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+  eval ac_cv_prog_make_${ac_make}_set=yes
+else
+  eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  SET_MAKE=
+else
+  echo "$ac_t""no" 1>&6
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+
+PACKAGE=metamail
+
+VERSION=0.0.1
+
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+  { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
+fi
+cat >> confdefs.h <<EOF
+#define PACKAGE "$PACKAGE"
+EOF
+
+cat >> confdefs.h <<EOF
+#define VERSION "$VERSION"
+EOF
+
+
+
+missing_dir=`cd $ac_aux_dir && pwd`
+echo $ac_n "checking for working aclocal-${am__api_version}""... $ac_c" 1>&6
+echo "configure:890: checking for working aclocal-${am__api_version}" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf.  Sigh.
+if (aclocal-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then
+   ACLOCAL=aclocal-${am__api_version}
+   echo "$ac_t""found" 1>&6
+else
+   ACLOCAL="$missing_dir/missing aclocal-${am__api_version}"
+   echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
+echo "configure:903: checking for working autoconf" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf.  Sigh.
+if (autoconf --version) < /dev/null > /dev/null 2>&1; then
+   AUTOCONF=autoconf
+   echo "$ac_t""found" 1>&6
+else
+   AUTOCONF="$missing_dir/missing autoconf"
+   echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working automake-${am__api_version}""... $ac_c" 1>&6
+echo "configure:916: checking for working automake-${am__api_version}" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf.  Sigh.
+if (automake-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then
+   AUTOMAKE=automake-${am__api_version}
+   echo "$ac_t""found" 1>&6
+else
+   AUTOMAKE="$missing_dir/missing automake-${am__api_version}"
+   echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
+echo "configure:929: checking for working autoheader" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf.  Sigh.
+if (autoheader --version) < /dev/null > /dev/null 2>&1; then
+   AUTOHEADER=autoheader
+   echo "$ac_t""found" 1>&6
+else
+   AUTOHEADER="$missing_dir/missing autoheader"
+   echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
+echo "configure:942: checking for working makeinfo" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf.  Sigh.
+if (makeinfo --version) < /dev/null > /dev/null 2>&1; then
+   MAKEINFO=makeinfo
+   echo "$ac_t""found" 1>&6
+else
+   MAKEINFO="$missing_dir/missing makeinfo"
+   echo "$ac_t""missing" 1>&6
+fi
+
+
+echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
+echo "configure:956: checking whether to enable maintainer-specific portions of Makefiles" >&5
+    # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+  enableval="$enable_maintainer_mode"
+  USE_MAINTAINER_MODE=$enableval
+else
+  USE_MAINTAINER_MODE=no
+fi
+
+  echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6
+  
+
+if test $USE_MAINTAINER_MODE = yes; then
+  MAINTAINER_MODE_TRUE=
+  MAINTAINER_MODE_FALSE='#'
+else
+  MAINTAINER_MODE_TRUE='#'
+  MAINTAINER_MODE_FALSE=
+fi
+  MAINT=$MAINTAINER_MODE_TRUE
+  
+
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:986: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+  case $nonopt in
+  NONE)
+    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+    fi ;;
+  *) host_alias=$nonopt ;;
+  esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1010: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="gcc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1040: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_prog_rejected=no
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+        ac_prog_rejected=yes
+	continue
+      fi
+      ac_cv_prog_CC="cc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# -gt 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    set dummy "$ac_dir/$ac_word" "$@"
+    shift
+    ac_cv_prog_CC="$@"
+  fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  if test -z "$CC"; then
+    case "`uname -s`" in
+    *win32* | *WIN32*)
+      # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1091: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="cl"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+ ;;
+    esac
+  fi
+  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:1123: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 1134 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:1139: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  ac_cv_prog_cc_works=yes
+  # If we can't run a trivial program, we are probably using a cross compiler.
+  if (./conftest; exit) 2>/dev/null; then
+    ac_cv_prog_cc_cross=no
+  else
+    ac_cv_prog_cc_cross=yes
+  fi
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+  { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:1165: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:1170: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.c <<EOF
+#ifdef __GNUC__
+  yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1179: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+  ac_cv_prog_gcc=yes
+else
+  ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:1198: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+  ac_cv_prog_cc_g=yes
+else
+  ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+
+# Find the correct PATH separator.  Usually this is `:', but
+# DJGPP uses `;' like DOS.
+if test "X${PATH_SEPARATOR+set}" != Xset; then
+  UNAME=${UNAME-`uname 2>/dev/null`}
+  case X$UNAME in
+    *-DOS) lt_cv_sys_path_separator=';' ;;
+    *)     lt_cv_sys_path_separator=':' ;;
+  esac
+  PATH_SEPARATOR=$lt_cv_sys_path_separator
+fi
+
+echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
+echo "configure:1241: checking for Cygwin environment" >&5
+if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1246 "configure"
+#include "confdefs.h"
+
+int main() {
+
+#ifndef __CYGWIN__
+#define __CYGWIN__ __CYGWIN32__
+#endif
+return __CYGWIN__;
+; return 0; }
+EOF
+if { (eval echo configure:1257: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_cygwin=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_cygwin=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_cygwin" 1>&6
+CYGWIN=
+test "$ac_cv_cygwin" = yes && CYGWIN=yes
+echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
+echo "configure:1274: checking for mingw32 environment" >&5
+if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1279 "configure"
+#include "confdefs.h"
+
+int main() {
+return __MINGW32__;
+; return 0; }
+EOF
+if { (eval echo configure:1286: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_mingw32=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_mingw32=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_mingw32" 1>&6
+MINGW32=
+test "$ac_cv_mingw32" = yes && MINGW32=yes
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1303: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    # This must be in double quotes, not single quotes, because CPP may get
+  # substituted into the Makefile and "${CC-cc}" will confuse make.
+  CPP="${CC-cc} -E"
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp.
+  cat > conftest.$ac_ext <<EOF
+#line 1318 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1324: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -E -traditional-cpp"
+  cat > conftest.$ac_ext <<EOF
+#line 1335 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1341: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -nologo -E"
+  cat > conftest.$ac_ext <<EOF
+#line 1352 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1358: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+  ac_cv_prog_CPP="$CPP"
+fi
+  CPP="$ac_cv_prog_CPP"
+else
+  ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+  enableval="$enable_shared"
+  p=${PACKAGE-default}
+case $enableval in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+  enable_shared=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_shared=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+else
+  enable_shared=yes
+fi
+
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+  enableval="$enable_static"
+  p=${PACKAGE-default}
+case $enableval in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+  enable_static=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_static=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+else
+  enable_static=yes
+fi
+
+# Check whether --enable-fast-install or --disable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+  enableval="$enable_fast_install"
+  p=${PACKAGE-default}
+case $enableval in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+  enable_fast_install=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_fast_install=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+else
+  enable_fast_install=yes
+fi
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:1452: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+  case $nonopt in
+  NONE) build_alias=$host_alias ;;
+  *) build_alias=$nonopt ;;
+  esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+  withval="$with_gnu_ld"
+  test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
+echo "configure:1481: checking for ld used by GCC" >&5
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | [A-Za-z]:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the path of ld
+      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
+echo "configure:1511: checking for GNU ld" >&5
+else
+  echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
+echo "configure:1514: checking for non-GNU ld" >&5
+fi
+if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -z "$LD"; then
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some GNU ld's only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+	test "$with_gnu_ld" != no && break
+      else
+	test "$with_gnu_ld" != yes && break
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  echo "$ac_t""$LD" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
+echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
+echo "configure:1549: checking if the linker ($LD) is GNU ld" >&5
+if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+  lt_cv_prog_gnu_ld=yes
+else
+  lt_cv_prog_gnu_ld=no
+fi
+fi
+
+echo "$ac_t""$lt_cv_prog_gnu_ld" 1>&6
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
+echo "configure:1566: checking for $LD option to reload object files" >&5
+if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  lt_cv_ld_reload_flag='-r'
+fi
+
+echo "$ac_t""$lt_cv_ld_reload_flag" 1>&6
+reload_flag=$lt_cv_ld_reload_flag
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+
+echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
+echo "configure:1578: checking for BSD-compatible nm" >&5
+if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+    test -z "$ac_dir" && ac_dir=.
+    tmp_nm=$ac_dir/${ac_tool_prefix}nm
+    if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
+      # Check to see if the nm accepts a BSD-compat flag.
+      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+      #   nm: unknown option "B" ignored
+      # Tru64's nm complains that /dev/null is an invalid object file
+      if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
+	lt_cv_path_NM="$tmp_nm -B"
+	break
+      elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+	lt_cv_path_NM="$tmp_nm -p"
+	break
+      else
+	lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	continue # so that we can try to find one that supports BSD flags
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi
+fi
+
+NM="$lt_cv_path_NM"
+echo "$ac_t""$NM" 1>&6
+
+echo $ac_n "checking for a sed that does not truncate output""... $ac_c" 1>&6
+echo "configure:1616: checking for a sed that does not truncate output" >&5
+if eval "test \"`echo '$''{'lt_cv_path_SED'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  # Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_executable_p="test -f"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+        _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+
+  # Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+: ${TMPDIR=/tmp}
+{
+  tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=$TMPDIR/sed$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in $TMPDIR" >&2
+   { (exit 1); exit 1; }
+}
+  _max=0
+  _count=0
+  # Add /usr/xpg4/bin/sed as it is typically found on Solaris
+  # along with /bin/sed that truncates output.
+  for _sed in $_sed_list /usr/xpg4/bin/sed; do
+    test ! -f ${_sed} && break
+    cat /dev/null > "$tmp/sed.in"
+    _count=0
+    echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in"
+    # Check for GNU sed and select it if it is found.
+    if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then
+      lt_cv_path_SED=${_sed}
+      break
+    fi
+    while true; do
+      cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp"
+      mv "$tmp/sed.tmp" "$tmp/sed.in"
+      cp "$tmp/sed.in" "$tmp/sed.nl"
+      echo >>"$tmp/sed.nl"
+      ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break
+      cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break
+      # 40000 chars as input seems more than enough
+      test $_count -gt 10 && break
+      _count=`expr $_count + 1`
+      if test $_count -gt $_max; then
+        _max=$_count
+        lt_cv_path_SED=$_sed
+      fi
+    done
+  done
+  rm -rf "$tmp"
+
+fi
+
+if test "X$SED" != "X"; then
+  lt_cv_path_SED=$SED
+else
+  SED=$lt_cv_path_SED
+fi
+echo "$ac_t""$SED" 1>&6
+
+echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
+echo "configure:1700: checking whether ln -s works" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  rm -f conftestdata
+if ln -s X conftestdata 2>/dev/null
+then
+  rm -f conftestdata
+  ac_cv_prog_LN_S="ln -s"
+else
+  ac_cv_prog_LN_S=ln
+fi
+fi
+LN_S="$ac_cv_prog_LN_S"
+if test "$ac_cv_prog_LN_S" = "ln -s"; then
+  echo "$ac_t""yes" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking how to recognise dependent libraries""... $ac_c" 1>&6
+echo "configure:1721: checking how to recognise dependent libraries" >&5
+if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi4*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin* | mingw* | pw32*)
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  case "$host_os" in
+  rhapsody* | darwin1.[012])
+    lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1`
+    ;;
+  *) # Darwin 1.3 on
+    lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
+    ;;
+  esac
+  ;;
+
+freebsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20*|hpux11*)
+  lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libc.sl
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+  irix5* | nonstopux*)
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+    ;;
+  *)
+    case $LD in
+    *-32|*"-32 ") libmagic=32-bit;;
+    *-n32|*"-n32 ") libmagic=N32;;
+    *-64|*"-64 ") libmagic=64-bit;;
+    *) libmagic=never-match;;
+    esac
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"
+    ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+  case $host_cpu in
+  alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64*)
+    lt_cv_deplibs_check_method=pass_all ;;
+  *)
+    # glibc up to 2.1.1 does not perform some relocations on ARM
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+openbsd*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+  else
+    lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  # this will be overridden with pass_all, but let us keep it just in case
+  lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sco3.2v5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  lt_cv_file_magic_test_file=/lib/libc.so
+  ;;
+
+sysv5uw[78]* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+esac
+
+fi
+
+echo "$ac_t""$lt_cv_deplibs_check_method" 1>&6
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+
+echo $ac_n "checking for object suffix""... $ac_c" 1>&6
+echo "configure:1907: checking for object suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  rm -f conftest*
+echo 'int i = 1;' > conftest.$ac_ext
+if { (eval echo configure:1913: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  for ac_file in conftest.*; do
+    case $ac_file in
+    *.c) ;;
+    *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
+    esac
+  done
+else
+  { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; }
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_objext" 1>&6
+OBJEXT=$ac_cv_objext
+ac_objext=$ac_cv_objext
+
+
+
+echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+echo "configure:1933: checking for executable suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+  ac_cv_exeext=.exe
+else
+  rm -f conftest*
+  echo 'int main () { return 0; }' > conftest.$ac_ext
+  ac_cv_exeext=
+  if { (eval echo configure:1943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+    for file in conftest.*; do
+      case $file in
+      *.$ac_ext | *.c | *.o | *.obj) ;;
+      *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+      esac
+    done
+  else
+    { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
+  fi
+  rm -f conftest*
+  test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
+fi
+fi
+
+EXEEXT=""
+test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
+echo "$ac_t""${ac_cv_exeext}" 1>&6
+ac_exeext=$EXEEXT
+
+if test $host != $build; then
+  ac_tool_prefix=${host_alias}-
+else
+  ac_tool_prefix=
+fi
+
+
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+echo $ac_n "checking command to parse $NM output""... $ac_c" 1>&6
+echo "configure:1974: checking command to parse $NM output" >&5
+if eval "test \"`echo '$''{'lt_cv_sys_global_symbol_pipe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Transform the above into a raw symbol and a C symbol.
+symxfrm='\1 \2\3 \3'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[BCDT]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[ABCDGISTW]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+  lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  ;;
+irix* | nonstopux*)
+  symcode='[BCDEGRST]'
+  ;;
+osf*)
+  symcode='[BCDEGQRST]'
+  ;;
+solaris* | sysv5*)
+  symcode='[BDT]'
+  ;;
+sysv4)
+  symcode='[DFNSTU]'
+  ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $host_os in
+mingw*)
+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
+  symcode='[ABCDGISTW]'
+fi
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Write the raw and C identifiers.
+lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ 	]\($symcode$symcode*\)[ 	][ 	]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+  rm -f conftest*
+  cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+  if { (eval echo configure:2057: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if { (eval echo configure:2060: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5; } && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if egrep ' nm_test_var$' "$nlist" >/dev/null; then
+	if egrep ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext'
+
+	  cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr address;
+}
+lt_preloaded_symbols[] =
+{
+EOF
+	  sed "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext
+	  cat <<\EOF >> conftest.$ac_ext
+  {0, (lt_ptr) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  save_LIBS="$LIBS"
+	  save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$no_builtin_flag"
+	  if { (eval echo configure:2111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest$ac_exeext; then
+	    pipe_works=yes
+	  fi
+	  LIBS="$save_LIBS"
+	  CFLAGS="$save_CFLAGS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&5
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&5
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+    fi
+  else
+    echo "$progname: failed program was:" >&5
+    cat conftest.$ac_ext >&5
+  fi
+  rm -f conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+
+fi
+
+global_symbol_pipe="$lt_cv_sys_global_symbol_pipe"
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  global_symbol_to_cdecl=
+  global_symbol_to_c_name_address=
+else
+  global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl"
+  global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address"
+fi
+if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address";
+then
+  echo "$ac_t""failed" 1>&6
+else
+  echo "$ac_t""ok" 1>&6
+fi
+
+for ac_hdr in dlfcn.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2160: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2165 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2170: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+
+
+
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
+echo "configure:2206: checking for ${ac_tool_prefix}file" >&5
+if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case $MAGIC_CMD in
+  /*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+  ?:/*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+  ;;
+  *)
+  ac_save_MAGIC_CMD="$MAGIC_CMD"
+  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="/usr/bin:$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/${ac_tool_prefix}file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    egrep "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  MAGIC_CMD="$ac_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  echo "$ac_t""$MAGIC_CMD" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    echo $ac_n "checking for file""... $ac_c" 1>&6
+echo "configure:2268: checking for file" >&5
+if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case $MAGIC_CMD in
+  /*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+  ?:/*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+  ;;
+  *)
+  ac_save_MAGIC_CMD="$MAGIC_CMD"
+  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="/usr/bin:$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    egrep "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  MAGIC_CMD="$ac_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  echo "$ac_t""$MAGIC_CMD" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  else
+    MAGIC_CMD=:
+  fi
+fi
+
+  fi
+  ;;
+esac
+
+# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2339: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+  echo "$ac_t""$RANLIB" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_RANLIB"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2371: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_RANLIB="ranlib"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+  echo "$ac_t""$RANLIB" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  RANLIB=":"
+fi
+fi
+
+# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2406: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+STRIP="$ac_cv_prog_STRIP"
+if test -n "$STRIP"; then
+  echo "$ac_t""$STRIP" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_STRIP"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2438: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_STRIP="strip"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":"
+fi
+fi
+STRIP="$ac_cv_prog_STRIP"
+if test -n "$STRIP"; then
+  echo "$ac_t""$STRIP" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  STRIP=":"
+fi
+fi
+
+
+enable_dlopen=no
+enable_win32_dll=no
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval="$enable_libtool_lock"
+  :
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '#line 2487 "configure"' > conftest.$ac_ext
+  if { (eval echo configure:2488: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
+echo "configure:2509: checking whether the C compiler needs -belf" >&5
+if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+     ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+     cat > conftest.$ac_ext <<EOF
+#line 2522 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:2529: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  lt_cv_cc_needs_belf=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  lt_cv_cc_needs_belf=no
+fi
+rm -f conftest*
+     ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+fi
+
+echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+
+
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e s/^X//'
+sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+need_locks="$enable_libtool_lock"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+if test x"$host" != x"$build"; then
+  ac_tool_prefix=${host_alias}-
+else
+  ac_tool_prefix=
+fi
+
+# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+case $host_os in
+linux-gnu*) ;;
+linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+esac
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds"
+    ;;
+  *)
+    old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+# Allow CC to be a program name with arguments.
+set dummy $CC
+compiler="$2"
+
+echo $ac_n "checking for objdir""... $ac_c" 1>&6
+echo "configure:2649: checking for objdir" >&5
+rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+echo "$ac_t""$objdir" 1>&6
+
+
+# Check whether --with-pic or --without-pic was given.
+if test "${with_pic+set}" = set; then
+  withval="$with_pic"
+  pic_mode="$withval"
+else
+  pic_mode=default
+fi
+
+test -z "$pic_mode" && pic_mode=default
+
+# We assume here that the value for lt_cv_prog_cc_pic will not be cached
+# in isolation, and that seeing it set (from the cache) indicates that
+# the associated values are set (in the cache) correctly too.
+echo $ac_n "checking for $compiler option to produce PIC""... $ac_c" 1>&6
+echo "configure:2676: checking for $compiler option to produce PIC" >&5
+if eval "test \"`echo '$''{'lt_cv_prog_cc_pic'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+   lt_cv_prog_cc_pic=
+  lt_cv_prog_cc_shlib=
+  lt_cv_prog_cc_wl=
+  lt_cv_prog_cc_static=
+  lt_cv_prog_cc_no_builtin=
+  lt_cv_prog_cc_can_build_shared=$can_build_shared
+
+  if test "$GCC" = yes; then
+    lt_cv_prog_cc_wl='-Wl,'
+    lt_cv_prog_cc_static='-static'
+
+    case $host_os in
+    aix*)
+      # Below there is a dirty hack to force normal static linking with -ldl
+      # The problem is because libdl dynamically linked with both libc and
+      # libC (AIX C++ library), which obviously doesn't included in libraries
+      # list by gcc. This cause undefined symbols with -static flags.
+      # This hack allows C programs to be linked with "-static -ldl", but
+      # not sure about C++ programs.
+      lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC"
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_cv_prog_cc_pic='-fno-common'
+      ;;
+    cygwin* | mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_cv_prog_cc_pic='-DDLL_EXPORT'
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	 lt_cv_prog_cc_pic=-Kconform_pic
+      fi
+      ;;
+    *)
+      lt_cv_prog_cc_pic='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for PIC flags for the system compiler.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      lt_cv_prog_cc_wl='-Wl,'
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_cv_prog_cc_static='-Bstatic'
+      else
+	lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      # Is there a better lt_cv_prog_cc_static that works with the bundled CC?
+      lt_cv_prog_cc_wl='-Wl,'
+      lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive"
+      lt_cv_prog_cc_pic='+Z'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_cv_prog_cc_wl='-Wl,'
+      lt_cv_prog_cc_static='-non_shared'
+      # PIC (with -KPIC) is the default.
+      ;;
+
+    cygwin* | mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_cv_prog_cc_pic='-DDLL_EXPORT'
+      ;;
+
+    newsos6)
+      lt_cv_prog_cc_pic='-KPIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      # All OSF/1 code is PIC.
+      lt_cv_prog_cc_wl='-Wl,'
+      lt_cv_prog_cc_static='-non_shared'
+      ;;
+
+    sco3.2v5*)
+      lt_cv_prog_cc_pic='-Kpic'
+      lt_cv_prog_cc_static='-dn'
+      lt_cv_prog_cc_shlib='-belf'
+      ;;
+
+    solaris*)
+      lt_cv_prog_cc_pic='-KPIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      lt_cv_prog_cc_wl='-Wl,'
+      ;;
+
+    sunos4*)
+      lt_cv_prog_cc_pic='-PIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      lt_cv_prog_cc_wl='-Qoption ld '
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+      lt_cv_prog_cc_pic='-KPIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      lt_cv_prog_cc_wl='-Wl,'
+      ;;
+
+    uts4*)
+      lt_cv_prog_cc_pic='-pic'
+      lt_cv_prog_cc_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_cv_prog_cc_pic='-Kconform_pic'
+	lt_cv_prog_cc_static='-Bstatic'
+      fi
+      ;;
+
+    *)
+      lt_cv_prog_cc_can_build_shared=no
+      ;;
+    esac
+  fi
+
+fi
+
+if test -z "$lt_cv_prog_cc_pic"; then
+  echo "$ac_t""none" 1>&6
+else
+  echo "$ac_t""$lt_cv_prog_cc_pic" 1>&6
+
+  # Check to make sure the pic_flag actually works.
+  echo $ac_n "checking if $compiler PIC flag $lt_cv_prog_cc_pic works""... $ac_c" 1>&6
+echo "configure:2824: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5
+  if eval "test \"`echo '$''{'lt_cv_prog_cc_pic_works'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+      save_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC"
+    cat > conftest.$ac_ext <<EOF
+#line 2831 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:2838: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+        case $host_os in
+      hpux9* | hpux10* | hpux11*)
+	# On HP-UX, both CC and GCC only warn that PIC is supported... then
+	# they create non-PIC objects.  So, if there were any warnings, we
+	# assume that PIC is not supported.
+	if test -s conftest.err; then
+	  lt_cv_prog_cc_pic_works=no
+	else
+	  lt_cv_prog_cc_pic_works=yes
+	fi
+	;;
+      *)
+	lt_cv_prog_cc_pic_works=yes
+	;;
+      esac
+    
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+        lt_cv_prog_cc_pic_works=no
+    
+fi
+rm -f conftest*
+    CFLAGS="$save_CFLAGS"
+  
+fi
+
+
+  if test "X$lt_cv_prog_cc_pic_works" = Xno; then
+    lt_cv_prog_cc_pic=
+    lt_cv_prog_cc_can_build_shared=no
+  else
+    lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic"
+  fi
+
+  echo "$ac_t""$lt_cv_prog_cc_pic_works" 1>&6
+fi
+
+# Check for any special shared library compilation flags.
+if test -n "$lt_cv_prog_cc_shlib"; then
+  echo "configure: warning: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" 1>&2
+  if echo "$old_CC $old_CFLAGS " | egrep -e "[ 	]$lt_cv_prog_cc_shlib[ 	]" >/dev/null; then :
+  else
+   echo "configure: warning: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" 1>&2
+    lt_cv_prog_cc_can_build_shared=no
+  fi
+fi
+
+echo $ac_n "checking if $compiler static flag $lt_cv_prog_cc_static works""... $ac_c" 1>&6
+echo "configure:2890: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5
+if eval "test \"`echo '$''{'lt_cv_prog_cc_static_works'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    lt_cv_prog_cc_static_works=no
+  save_LDFLAGS="$LDFLAGS"
+  LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static"
+  cat > conftest.$ac_ext <<EOF
+#line 2898 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:2905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  lt_cv_prog_cc_static_works=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+  LDFLAGS="$save_LDFLAGS"
+
+fi
+
+
+# Belt *and* braces to stop my trousers falling down:
+test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static=
+echo "$ac_t""$lt_cv_prog_cc_static_works" 1>&6
+
+pic_flag="$lt_cv_prog_cc_pic"
+special_shlib_compile_flags="$lt_cv_prog_cc_shlib"
+wl="$lt_cv_prog_cc_wl"
+link_static_flag="$lt_cv_prog_cc_static"
+no_builtin_flag="$lt_cv_prog_cc_no_builtin"
+can_build_shared="$lt_cv_prog_cc_can_build_shared"
+
+
+# Check to see if options -o and -c are simultaneously supported by compiler
+echo $ac_n "checking if $compiler supports -c -o file.$ac_objext""... $ac_c" 1>&6
+echo "configure:2932: checking if $compiler supports -c -o file.$ac_objext" >&5
+if eval "test \"`echo '$''{'lt_cv_compiler_c_o'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+$rm -r conftest 2>/dev/null
+mkdir conftest
+cd conftest
+echo "int some_variable = 0;" > conftest.$ac_ext
+mkdir out
+# According to Tom Tromey, Ian Lance Taylor reported there are C compilers
+# that will create temporary files in the current directory regardless of
+# the output directory.  Thus, making CWD read-only will cause this test
+# to fail, enabling locking or at least warning the user not to do parallel
+# builds.
+chmod -w .
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
+compiler_c_o=no
+if { (eval echo configure:2951: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
+  # The compiler can only warn and ignore the option if not recognized
+  # So say no if there are warnings
+  if test -s out/conftest.err; then
+    lt_cv_compiler_c_o=no
+  else
+    lt_cv_compiler_c_o=yes
+  fi
+else
+  # Append any errors to the config.log.
+  cat out/conftest.err 1>&5
+  lt_cv_compiler_c_o=no
+fi
+CFLAGS="$save_CFLAGS"
+chmod u+w .
+$rm conftest* out/*
+rmdir out
+cd ..
+rmdir conftest
+$rm -r conftest 2>/dev/null
+
+fi
+
+compiler_c_o=$lt_cv_compiler_c_o
+echo "$ac_t""$compiler_c_o" 1>&6
+
+if test x"$compiler_c_o" = x"yes"; then
+  # Check to see if we can write to a .lo
+  echo $ac_n "checking if $compiler supports -c -o file.lo""... $ac_c" 1>&6
+echo "configure:2980: checking if $compiler supports -c -o file.lo" >&5
+  if eval "test \"`echo '$''{'lt_cv_compiler_o_lo'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+  lt_cv_compiler_o_lo=no
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -c -o conftest.lo"
+  save_objext="$ac_objext"
+  ac_objext=lo
+  cat > conftest.$ac_ext <<EOF
+#line 2991 "configure"
+#include "confdefs.h"
+
+int main() {
+int some_variable = 0;
+; return 0; }
+EOF
+if { (eval echo configure:2998: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+      # The compiler can only warn and ignore the option if not recognized
+    # So say no if there are warnings
+    if test -s conftest.err; then
+      lt_cv_compiler_o_lo=no
+    else
+      lt_cv_compiler_o_lo=yes
+    fi
+  
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+  ac_objext="$save_objext"
+  CFLAGS="$save_CFLAGS"
+  
+fi
+
+  compiler_o_lo=$lt_cv_compiler_o_lo
+  echo "$ac_t""$compiler_o_lo" 1>&6
+else
+  compiler_o_lo=no
+fi
+
+# Check to see if we can do hard links to lock some files if needed
+hard_links="nottested"
+if test "$compiler_c_o" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  echo $ac_n "checking if we can lock with hard links""... $ac_c" 1>&6
+echo "configure:3029: checking if we can lock with hard links" >&5
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  echo "$ac_t""$hard_links" 1>&6
+  if test "$hard_links" = no; then
+    echo "configure: warning: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" 1>&2
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+if test "$GCC" = yes; then
+  # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
+  echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions""... $ac_c" 1>&6
+echo "configure:3048: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext"
+  compiler_rtti_exceptions=no
+  cat > conftest.$ac_ext <<EOF
+#line 3054 "configure"
+#include "confdefs.h"
+
+int main() {
+int some_variable = 0;
+; return 0; }
+EOF
+if { (eval echo configure:3061: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+      # The compiler can only warn and ignore the option if not recognized
+    # So say no if there are warnings
+    if test -s conftest.err; then
+      compiler_rtti_exceptions=no
+    else
+      compiler_rtti_exceptions=yes
+    fi
+  
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+  CFLAGS="$save_CFLAGS"
+  echo "$ac_t""$compiler_rtti_exceptions" 1>&6
+
+  if test "$compiler_rtti_exceptions" = "yes"; then
+    no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
+  else
+    no_builtin_flag=' -fno-builtin'
+  fi
+fi
+
+# See if the linker supports building shared libraries.
+echo $ac_n "checking whether the linker ($LD) supports shared libraries""... $ac_c" 1>&6
+echo "configure:3088: checking whether the linker ($LD) supports shared libraries" >&5
+
+allow_undefined_flag=
+no_undefined_flag=
+need_lib_prefix=unknown
+need_version=unknown
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+archive_cmds=
+archive_expsym_cmds=
+old_archive_from_new_cmds=
+old_archive_from_expsyms_cmds=
+export_dynamic_flag_spec=
+whole_archive_flag_spec=
+thread_safe_flag_spec=
+hardcode_into_libs=no
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+hardcode_shlibpath_var=unsupported
+runpath_var=
+link_all_deplibs=unknown
+always_export_symbols=no
+export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
+# include_expsyms should be a list of space-separated symbols to be *always*
+# included in the symbol list
+include_expsyms=
+# exclude_expsyms can be an egrep regular expression of symbols to exclude
+# it will be wrapped by ` (' and `)$', so one must not match beginning or
+# end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+# as well as any symbol that contains `d'.
+exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+# platforms (ab)use it in PIC code, but their linkers get confused if
+# the symbol is explicitly referenced.  Since portable code cannot
+# rely on this symbol name, it's probably fine to never include it in
+# preloaded symbol tables.
+extract_expsyms_cmds=
+
+case $host_os in
+cygwin* | mingw* | pw32*)
+  # FIXME: the MSVC++ port hasn't been tested in a loooong time
+  # When not using gcc, we currently assume that we are using
+  # Microsoft Visual C++.
+  if test "$GCC" != yes; then
+    with_gnu_ld=no
+  fi
+  ;;
+openbsd*)
+  with_gnu_ld=no
+  ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+  # If archive_cmds runs LD, not CC, wlarc should be empty
+  wlarc='${wl}'
+
+  # See if GNU ld supports shared libraries.
+  case $host_os in
+  aix3* | aix4* | aix5*)
+    # On AIX, the GNU linker is very broken
+    # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available.
+    ld_shlibs=no
+    cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+    ;;
+
+  amigaos*)
+    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+
+    # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+    # that the semantics of dynamic libraries on AmigaOS, at least up
+    # to version 4, is to share data among multiple programs linked
+    # with the same dynamic library.  Since this doesn't match the
+    # behavior of shared libraries on other platforms, we can use
+    # them.
+    ld_shlibs=no
+    ;;
+
+  beos*)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      allow_undefined_flag=unsupported
+      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+      # support --undefined.  This deserves some investigation.  FIXME
+      archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # hardcode_libdir_flag_spec is actually meaningless, as there is
+    # no search path for DLLs.
+    hardcode_libdir_flag_spec='-L$libdir'
+    allow_undefined_flag=unsupported
+    always_export_symbols=yes
+
+    extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
+      sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~
+      test -f $output_objdir/impgen.exe || (cd $output_objdir && \
+      if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
+      else $CC -o impgen impgen.c ; fi)~
+      $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
+
+    old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
+
+    # cygwin and mingw dlls have different entry points and sets of symbols
+    # to exclude.
+    # FIXME: what about values for MSVC?
+    dll_entry=__cygwin_dll_entry@12
+    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
+    case $host_os in
+    mingw*)
+      # mingw values
+      dll_entry=_DllMainCRTStartup@12
+      dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
+      ;;
+    esac
+
+    # mingw and cygwin differ, and it's simplest to just exclude the union
+    # of the two symbol sets.
+    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
+
+    # recent cygwin and mingw systems supply a stub DllMain which the user
+    # can override, but on older systems we have to supply one (in ltdll.c)
+    if test "x$lt_cv_need_dllmain" = "xyes"; then
+      ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext "
+      ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~
+	test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
+    else
+      ltdll_obj=
+      ltdll_cmds=
+    fi
+
+    # Extract the symbol export list from an `--export-all' def file,
+    # then regenerate the def file from the symbol export list, so that
+    # the compiled dll only exports the symbol export list.
+    # Be careful not to strip the DATA tag left be newer dlltools.
+    export_symbols_cmds="$ltdll_cmds"'
+      $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
+      sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols'
+
+    # If the export-symbols file already is a .def file (1st line
+    # is EXPORTS), use it as is.
+    # If DATA tags from a recent dlltool are present, honour them!
+    archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then
+	cp $export_symbols $output_objdir/$soname-def;
+      else
+	echo EXPORTS > $output_objdir/$soname-def;
+	_lt_hint=1;
+	cat $export_symbols | while read symbol; do
+	 set dummy \$symbol;
+	 case \$# in
+	   2) echo "   \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
+	   4) echo "   \$2 \$3 \$4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;;
+	   *) echo "     \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;;
+	 esac;
+	 _lt_hint=`expr 1 + \$_lt_hint`;
+	done;
+      fi~
+      '"$ltdll_cmds"'
+      $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
+      $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~
+      $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
+    ;;
+
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+      wlarc=
+    else
+      archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    fi
+    ;;
+
+  solaris* | sysv5*)
+    if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
+      ld_shlibs=no
+      cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+    elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
+  sunos4*)
+    archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+    wlarc=
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  *)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+  esac
+
+  if test "$ld_shlibs" = yes; then
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    case $host_os in
+    cygwin* | mingw* | pw32*)
+      # dlltool doesn't understand --whole-archive et. al.
+      whole_archive_flag_spec=
+      ;;
+    *)
+      # ancient GNU ld didn't support --whole-archive et. al.
+      if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
+	whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+	whole_archive_flag_spec=
+      fi
+      ;;
+    esac
+  fi
+else
+  # PORTME fill in a description of your system's linker (not GNU ld)
+  case $host_os in
+  aix3*)
+    allow_undefined_flag=unsupported
+    always_export_symbols=yes
+    archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+    # Note: this linker hardcodes the directories in LIBPATH if there
+    # are no directories specified by -L.
+    hardcode_minus_L=yes
+    if test "$GCC" = yes && test -z "$link_static_flag"; then
+      # Neither direct hardcoding nor static linking is supported with a
+      # broken collect2.
+      hardcode_direct=unsupported
+    fi
+    ;;
+
+  aix4* | aix5*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+	for ld_flag in $LDFLAGS; do
+	  case $ld_flag in
+	  *-brtl*)
+	    aix_use_runtimelinking=yes
+	    break
+	  ;;
+	  esac
+	done
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
+    # When large executables or shared objects are built, AIX ld can
+    # have problems creating the table of contents.  If linking a library
+    # or program results in "error TOC overflow" add -mminimal-toc to
+    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+    hardcode_direct=yes
+    archive_cmds=''
+    hardcode_libdir_separator=':'
+    if test "$GCC" = yes; then
+      case $host_os in aix4.[012]|aix4.[012].*)
+	collect2name=`${CC} -print-prog-name=collect2`
+	if test -f "$collect2name" && \
+	  strings "$collect2name" | grep resolve_lib_name >/dev/null
+	then
+	  # We have reworked collect2
+	  hardcode_direct=yes
+	else
+	  # We have old collect2
+	  hardcode_direct=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  hardcode_minus_L=yes
+	  hardcode_libdir_flag_spec='-L$libdir'
+	  hardcode_libdir_separator=
+	fi
+      esac
+
+      shared_flag='-shared'
+    else
+      # not using gcc
+      if test "$host_cpu" = ia64; then
+	shared_flag='${wl}-G'
+      else
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag='${wl}-G'
+	else
+	  shared_flag='${wl}-bM:SRE'
+	fi
+      fi
+    fi
+
+    # It seems that -bexpall can do strange things, so it is better to
+    # generate a list of symbols to export.
+    always_export_symbols=yes
+    if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other runtime loading flags (-brtl),
+      # -berok will link without error, but may produce a broken library.
+      allow_undefined_flag='-berok'
+      hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
+      archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+    else
+      if test "$host_cpu" = ia64; then
+	hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+	allow_undefined_flag="-z nodefs"
+	archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+      else
+	hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib'
+	# Warning - without using the other run time loading flags,
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag='${wl}-berok'
+	# This is a bit strange, but is similar to how AIX traditionally builds
+	# it's shared libraries.
+	archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $output_objdir/$libname$release.a $output_objdir/$soname'
+      fi
+    fi
+    ;;
+
+  amigaos*)
+    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    # see comment about different semantics on the GNU ld section
+    ld_shlibs=no
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    # hardcode_libdir_flag_spec is actually meaningless, as there is
+    # no search path for DLLs.
+    hardcode_libdir_flag_spec=' '
+    allow_undefined_flag=unsupported
+    # Tell ltmain to make .lib files, not .a files.
+    libext=lib
+    # FIXME: Setting linknames here is a bad hack.
+    archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+    # The linker will automatically build a .lib file if we build a DLL.
+    old_archive_from_new_cmds='true'
+    # FIXME: Should let the user specify the lib program.
+    old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
+    fix_srcfile_path='`cygpath -w "$srcfile"`'
+    ;;
+
+  darwin* | rhapsody*)
+    case "$host_os" in
+    rhapsody* | darwin1.[012])
+      allow_undefined_flag='-undefined suppress'
+      ;;
+    *) # Darwin 1.3 on
+      allow_undefined_flag='-flat_namespace -undefined suppress'
+      ;;
+    esac
+    # FIXME: Relying on posixy $() will cause problems for
+    #        cross-compilation, but unfortunately the echo tests do not
+    #        yet detect zsh echo's removal of \ escapes.  Also zsh mangles
+    #	     `"' quotes if we put them in here... so don't!
+    archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)'
+    # We need to add '_' to the symbols in $export_symbols first
+    #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    whole_archive_flag_spec='-all_load $convenience'
+    ;;
+
+  freebsd1*)
+    ld_shlibs=no
+    ;;
+
+  # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+  # support.  Future versions do this automatically, but an explicit c++rt0.o
+  # does not break anything, and helps significantly (at the cost of a little
+  # extra space).
+  freebsd2.2*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+  freebsd2*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+  freebsd*)
+    archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  hpux9* | hpux10* | hpux11*)
+    case $host_os in
+    hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
+    *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
+    esac
+    hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+    hardcode_libdir_separator=:
+    hardcode_direct=yes
+    hardcode_minus_L=yes # Not in the search PATH, but as the default
+			 # location of the library.
+    export_dynamic_flag_spec='${wl}-E'
+    ;;
+
+  irix5* | irix6* | nonstopux*)
+    if test "$GCC" = yes; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    else
+      archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='-rpath $libdir'
+    fi
+    hardcode_libdir_separator=:
+    link_all_deplibs=yes
+    ;;
+
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+    else
+      archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+    fi
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  newsos6)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    hardcode_shlibpath_var=no
+    ;;
+
+  openbsd*)
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec='${wl}-E'
+    else
+      case "$host_os" in
+      openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_libdir_flag_spec='-R$libdir'
+        ;;
+      *)
+        archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+        hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+        ;;
+      esac
+    fi
+    ;;
+
+  os2*)
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    allow_undefined_flag=unsupported
+    archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+    old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+    ;;
+
+  osf3*)
+    if test "$GCC" = yes; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+    else
+      allow_undefined_flag=' -expect_unresolved \*'
+      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+    fi
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    ;;
+
+  osf4* | osf5*)	# as osf3* with the addition of -msym flag
+    if test "$GCC" = yes; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    else
+      allow_undefined_flag=' -expect_unresolved \*'
+      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+      $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
+
+      #Both c and cxx compiler support -rpath directly
+      hardcode_libdir_flag_spec='-rpath $libdir'
+    fi
+    hardcode_libdir_separator=:
+    ;;
+
+  sco3.2v5*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_shlibpath_var=no
+    runpath_var=LD_RUN_PATH
+    hardcode_runpath_var=yes
+    export_dynamic_flag_spec='${wl}-Bexport'
+    ;;
+
+  solaris*)
+    # gcc --version < 3.0 without binutils cannot create self contained
+    # shared libraries reliably, requiring libgcc.a to resolve some of
+    # the object symbols generated in some cases.  Libraries that use
+    # assert need libgcc.a to resolve __eprintf, for example.  Linking
+    # a copy of libgcc.a into every shared library to guarantee resolving
+    # such symbols causes other problems:  According to Tim Van Holder
+    # <tim.van.holder@pandora.be>, C++ libraries end up with a separate
+    # (to the application) exception stack for one thing.
+    no_undefined_flag=' -z defs'
+    if test "$GCC" = yes; then
+      case `$CC --version 2>/dev/null` in
+      [12].*)
+	cat <<EOF 1>&2
+
+*** Warning: Releases of GCC earlier than version 3.0 cannot reliably
+*** create self contained shared libraries on Solaris systems, without
+*** introducing a dependency on libgcc.a.  Therefore, libtool is disabling
+*** -no-undefined support, which will at least allow you to build shared
+*** libraries.  However, you may find that when you link such libraries
+*** into an application without using GCC, you have to manually add
+*** \`gcc --print-libgcc-file-name\` to the link command.  We urge you to
+*** upgrade to a newer version of GCC.  Another option is to rebuild your
+*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer.
+
+EOF
+        no_undefined_flag=
+	;;
+      esac
+    fi
+    # $CC -shared without GNU ld will not create a library from C++
+    # object files and a static libstdc++, better avoid it by now
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_shlibpath_var=no
+    case $host_os in
+    solaris2.[0-5] | solaris2.[0-5].*) ;;
+    *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+      whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+    esac
+    link_all_deplibs=yes
+    ;;
+
+  sunos4*)
+    if test "x$host_vendor" = xsequent; then
+      # Use $CC to link under sequent, because it throws in some extra .o
+      # files that make .init and .fini sections work.
+      archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+    else
+      archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+    fi
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4)
+    case $host_vendor in
+      sni)
+        archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+        hardcode_direct=yes # is this really true???
+        ;;
+      siemens)
+        ## LD is ld it makes a PLAMLIB
+        ## CC just makes a GrossModule.
+        archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+        reload_cmds='$CC -r -o $output$reload_objs'
+        hardcode_direct=no
+        ;;
+      motorola)
+        archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+        hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+        ;;
+    esac
+    runpath_var='LD_RUN_PATH'
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4.3*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_shlibpath_var=no
+    export_dynamic_flag_spec='-Bexport'
+    ;;
+
+  sysv5*)
+    no_undefined_flag=' -z text'
+    # $CC -shared without GNU ld will not create a library from C++
+    # object files and a static libstdc++, better avoid it by now
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+    hardcode_libdir_flag_spec=
+    hardcode_shlibpath_var=no
+    runpath_var='LD_RUN_PATH'
+    ;;
+
+  uts4*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_shlibpath_var=no
+    ;;
+
+  dgux*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4*MP*)
+    if test -d /usr/nec; then
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      runpath_var=LD_RUN_PATH
+      hardcode_runpath_var=yes
+      ld_shlibs=yes
+    fi
+    ;;
+
+  sysv4.2uw2*)
+    archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_minus_L=no
+    hardcode_shlibpath_var=no
+    hardcode_runpath_var=yes
+    runpath_var=LD_RUN_PATH
+    ;;
+
+  sysv5uw7* | unixware7*)
+    no_undefined_flag='${wl}-z ${wl}text'
+    if test "$GCC" = yes; then
+      archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+    else
+      archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+    fi
+    runpath_var='LD_RUN_PATH'
+    hardcode_shlibpath_var=no
+    ;;
+
+  *)
+    ld_shlibs=no
+    ;;
+  esac
+fi
+echo "$ac_t""$ld_shlibs" 1>&6
+test "$ld_shlibs" = no && can_build_shared=no
+
+# Check hardcoding attributes.
+echo $ac_n "checking how to hardcode library paths into programs""... $ac_c" 1>&6
+echo "configure:3787: checking how to hardcode library paths into programs" >&5
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+   test -n "$runpath_var"; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$hardcode_shlibpath_var" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+echo "$ac_t""$hardcode_action" 1>&6
+
+striplib=
+old_striplib=
+echo $ac_n "checking whether stripping libraries is possible""... $ac_c" 1>&6
+echo "configure:3815: checking whether stripping libraries is possible" >&5
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  echo "$ac_t""yes" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+# PORTME Fill in your ld.so characteristics
+echo $ac_n "checking dynamic linker characteristics""... $ac_c" 1>&6
+echo "configure:3829: checking dynamic linker characteristics" >&5
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}.so$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+	if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	     echo ' yes '
+	     echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	  :
+	else
+	  can_build_shared=no
+	fi
+	;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can
+    # not hardcode correct soname into executable. Probably we can
+    # add versioning support to collect2, so additional links can
+    # be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}.so$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  hardcode_into_libs=yes
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}.so'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi4*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  export_dynamic_flag_spec=-rdynamic
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  need_version=no
+  need_lib_prefix=no
+  case $GCC,$host_os in
+  yes,cygwin*)
+    library_names_spec='$libname.dll.a'
+    soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
+    postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog .libs/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    ;;
+  yes,mingw*)
+    library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
+    sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"`
+    ;;
+  yes,pw32*)
+    library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll'
+    ;;
+  *)
+    library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  # FIXME: Relying on posixy $() will cause problems for
+  #        cross-compilation, but unfortunately the echo tests do not
+  #        yet detect zsh echo's removal of \ escapes.
+  library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)'
+  soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd*-gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU/FreeBSD ld.so'
+  ;;
+
+freebsd*)
+  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  *)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  dynamic_linker="$host_os dld.sl"
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  shlibpath_var=SHLIB_PATH
+  shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+  library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl'
+  soname_spec='${libname}${release}.sl$major'
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)          version_type=irix ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
+    soname_spec='${libname}${release}.so$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case "$host_os" in
+    openbsd2.[89] | openbsd2.[89].*)
+      shlibpath_overrides_runpath=no
+      ;;
+    *)
+      shlibpath_overrides_runpath=yes
+      ;;
+    esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+os2*)
+  libname_spec='$name'
+  need_lib_prefix=no
+  library_names_spec='$libname.dll $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_version=no
+  need_lib_prefix=no
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  hardcode_into_libs=yes
+  ;;
+
+sco3.2v5*)
+  version_type=osf
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
+    soname_spec='$libname.so.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+echo "$ac_t""$dynamic_linker" 1>&6
+test "$dynamic_linker" = no && can_build_shared=no
+
+# Report the final consequences.
+echo $ac_n "checking if libtool supports shared libraries""... $ac_c" 1>&6
+echo "configure:4253: checking if libtool supports shared libraries" >&5
+echo "$ac_t""$can_build_shared" 1>&6
+
+echo $ac_n "checking whether to build shared libraries""... $ac_c" 1>&6
+echo "configure:4257: checking whether to build shared libraries" >&5
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+
+aix4*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+  ;;
+esac
+echo "$ac_t""$enable_shared" 1>&6
+
+echo $ac_n "checking whether to build static libraries""... $ac_c" 1>&6
+echo "configure:4280: checking whether to build static libraries" >&5
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+echo "$ac_t""$enable_static" 1>&6
+
+if test "$hardcode_action" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  *)
+    echo $ac_n "checking for shl_load""... $ac_c" 1>&6
+echo "configure:4321: checking for shl_load" >&5
+if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 4326 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char shl_load(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char shl_load();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_shl_load) || defined (__stub___shl_load)
+choke me
+#else
+shl_load();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:4349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_shl_load=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_shl_load=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="shl_load"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
+echo "configure:4367: checking for shl_load in -ldld" >&5
+ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldld  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4375 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char shl_load();
+
+int main() {
+shl_load()
+; return 0; }
+EOF
+if { (eval echo configure:4386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dlopen""... $ac_c" 1>&6
+echo "configure:4405: checking for dlopen" >&5
+if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 4410 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char dlopen(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dlopen();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_dlopen) || defined (__stub___dlopen)
+choke me
+#else
+dlopen();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:4433: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_dlopen=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_dlopen=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="dlopen"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "configure:4451: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4459 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo configure:4470: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dlopen in -lsvld""... $ac_c" 1>&6
+echo "configure:4489: checking for dlopen in -lsvld" >&5
+ac_lib_var=`echo svld'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lsvld  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4497 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo configure:4508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6
+echo "configure:4527: checking for dld_link in -ldld" >&5
+ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldld  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4535 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dld_link();
+
+int main() {
+dld_link()
+; return 0; }
+EOF
+if { (eval echo configure:4546: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+	      
+fi
+
+	    
+fi
+
+	  
+fi
+
+	
+fi
+
+      
+fi
+
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+        test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6
+echo "configure:4602: checking whether a program can dlopen itself" >&5
+if eval "test \"`echo '$''{'lt_cv_dlopen_self'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 4612 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}
+EOF
+  if { (eval echo configure:4673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_unknown|x*) lt_cv_dlopen_self=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
+fi
+rm -fr conftest*
+
+    
+fi
+
+echo "$ac_t""$lt_cv_dlopen_self" 1>&6
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      LDFLAGS="$LDFLAGS $link_static_flag"
+      echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6
+echo "configure:4696: checking whether a statically linked program can dlopen itself" >&5
+if eval "test \"`echo '$''{'lt_cv_dlopen_self_static'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 4706 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}
+EOF
+  if { (eval echo configure:4767: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
+fi
+rm -fr conftest*
+
+      
+fi
+
+echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+
+if test "$enable_shared" = yes && test "$GCC" = yes; then
+  case $archive_cmds in
+  *'~'*)
+    # FIXME: we may have to deal with multi-command sequences.
+    ;;
+  '$CC '*)
+    # Test whether the compiler implicitly links with -lc since on some
+    # systems, -lgcc has to come before -lc. If gcc already passes -lc
+    # to ld, don't add -lc before -lgcc.
+    echo $ac_n "checking whether -lc should be explicitly linked in""... $ac_c" 1>&6
+echo "configure:4816: checking whether -lc should be explicitly linked in" >&5
+    if eval "test \"`echo '$''{'lt_cv_archive_cmds_need_lc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  $rm conftest*
+    echo 'static int dummy;' > conftest.$ac_ext
+
+    if { (eval echo configure:4823: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+      soname=conftest
+      lib=conftest
+      libobjs=conftest.$ac_objext
+      deplibs=
+      wl=$lt_cv_prog_cc_wl
+      compiler_flags=-v
+      linker_flags=-v
+      verstring=
+      output_objdir=.
+      libname=conftest
+      save_allow_undefined_flag=$allow_undefined_flag
+      allow_undefined_flag=
+      if { (eval echo configure:4836: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\") 1>&5; (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5; }
+      then
+	lt_cv_archive_cmds_need_lc=no
+      else
+	lt_cv_archive_cmds_need_lc=yes
+      fi
+      allow_undefined_flag=$save_allow_undefined_flag
+    else
+      cat conftest.err 1>&5
+    fi
+fi
+
+    echo "$ac_t""$lt_cv_archive_cmds_need_lc" 1>&6
+    ;;
+  esac
+fi
+need_lc=${lt_cv_archive_cmds_need_lc-yes}
+
+# The second clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  :
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  test -f Makefile && make "$ltmain"
+fi
+
+if test -f "$ltmain"; then
+  trap "$rm \"${ofile}T\"; exit 1" 1 2 15
+  $rm -f "${ofile}T"
+
+  echo creating $ofile
+
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS SED \
+    AR AR_FLAGS CC LD LN_S NM SHELL \
+    reload_flag reload_cmds wl \
+    pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
+    thread_safe_flag_spec whole_archive_flag_spec libname_spec \
+    library_names_spec soname_spec \
+    RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
+    old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \
+    postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \
+    old_striplib striplib file_magic_cmd export_symbols_cmds \
+    deplibs_check_method allow_undefined_flag no_undefined_flag \
+    finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
+    global_symbol_to_c_name_address \
+    hardcode_libdir_flag_spec hardcode_libdir_separator  \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
+
+    case $var in
+    reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
+    extract_expsyms_cmds | old_archive_from_expsyms_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  cat <<__EOF__ > "${ofile}T"
+#! $SHELL
+
+# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996-2000 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="${SED} -e s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$need_lc
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# The default C compiler.
+CC=$lt_CC
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_wl
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_pic_flag
+pic_mode=$pic_mode
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_compiler_c_o
+
+# Can we write directly to a .lo ?
+compiler_o_lo=$lt_compiler_o_lo
+
+# Must we lock files when doing compilation ?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_link_static_flag
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# ### END LIBTOOL CONFIG
+
+__EOF__
+
+  case $host_os in
+  aix3*)
+    cat <<\EOF >> "${ofile}T"
+
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+EOF
+    ;;
+  esac
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | os2*)
+    cat <<'EOF' >> "${ofile}T"
+      # This is a source program that is used to create dlls on Windows
+      # Don't remove nor modify the starting and closing comments
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# #  ifdef __CYGWIN32__
+# #    define __CYGWIN__ __CYGWIN32__
+# #  endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+#   __hDllInstance_base = hInst;
+#   return TRUE;
+# }
+# /* ltdll.c ends here */
+	# This is a source program that is used to create import libraries
+	# on Windows for dlls which lack them. Don't remove nor modify the
+	# starting and closing comments
+# /* impgen.c starts here */
+# /*   Copyright (C) 1999-2000 Free Software Foundation, Inc.
+#
+#  This file is part of GNU libtool.
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#  */
+#
+# #include <stdio.h>		/* for printf() */
+# #include <unistd.h>		/* for open(), lseek(), read() */
+# #include <fcntl.h>		/* for O_RDONLY, O_BINARY */
+# #include <string.h>		/* for strdup() */
+#
+# /* O_BINARY isn't required (or even defined sometimes) under Unix */
+# #ifndef O_BINARY
+# #define O_BINARY 0
+# #endif
+#
+# static unsigned int
+# pe_get16 (fd, offset)
+#      int fd;
+#      int offset;
+# {
+#   unsigned char b[2];
+#   lseek (fd, offset, SEEK_SET);
+#   read (fd, b, 2);
+#   return b[0] + (b[1]<<8);
+# }
+#
+# static unsigned int
+# pe_get32 (fd, offset)
+#     int fd;
+#     int offset;
+# {
+#   unsigned char b[4];
+#   lseek (fd, offset, SEEK_SET);
+#   read (fd, b, 4);
+#   return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# static unsigned int
+# pe_as32 (ptr)
+#      void *ptr;
+# {
+#   unsigned char *b = ptr;
+#   return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# int
+# main (argc, argv)
+#     int argc;
+#     char *argv[];
+# {
+#     int dll;
+#     unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
+#     unsigned long export_rva, export_size, nsections, secptr, expptr;
+#     unsigned long name_rvas, nexp;
+#     unsigned char *expdata, *erva;
+#     char *filename, *dll_name;
+#
+#     filename = argv[1];
+#
+#     dll = open(filename, O_RDONLY|O_BINARY);
+#     if (dll < 1)
+# 	return 1;
+#
+#     dll_name = filename;
+#
+#     for (i=0; filename[i]; i++)
+# 	if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
+# 	    dll_name = filename + i +1;
+#
+#     pe_header_offset = pe_get32 (dll, 0x3c);
+#     opthdr_ofs = pe_header_offset + 4 + 20;
+#     num_entries = pe_get32 (dll, opthdr_ofs + 92);
+#
+#     if (num_entries < 1) /* no exports */
+# 	return 1;
+#
+#     export_rva = pe_get32 (dll, opthdr_ofs + 96);
+#     export_size = pe_get32 (dll, opthdr_ofs + 100);
+#     nsections = pe_get16 (dll, pe_header_offset + 4 +2);
+#     secptr = (pe_header_offset + 4 + 20 +
+# 	      pe_get16 (dll, pe_header_offset + 4 + 16));
+#
+#     expptr = 0;
+#     for (i = 0; i < nsections; i++)
+#     {
+# 	char sname[8];
+# 	unsigned long secptr1 = secptr + 40 * i;
+# 	unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
+# 	unsigned long vsize = pe_get32 (dll, secptr1 + 16);
+# 	unsigned long fptr = pe_get32 (dll, secptr1 + 20);
+# 	lseek(dll, secptr1, SEEK_SET);
+# 	read(dll, sname, 8);
+# 	if (vaddr <= export_rva && vaddr+vsize > export_rva)
+# 	{
+# 	    expptr = fptr + (export_rva - vaddr);
+# 	    if (export_rva + export_size > vaddr + vsize)
+# 		export_size = vsize - (export_rva - vaddr);
+# 	    break;
+# 	}
+#     }
+#
+#     expdata = (unsigned char*)malloc(export_size);
+#     lseek (dll, expptr, SEEK_SET);
+#     read (dll, expdata, export_size);
+#     erva = expdata - export_rva;
+#
+#     nexp = pe_as32 (expdata+24);
+#     name_rvas = pe_as32 (expdata+32);
+#
+#     printf ("EXPORTS\n");
+#     for (i = 0; i<nexp; i++)
+#     {
+# 	unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
+# 	printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
+#     }
+#
+#     return 0;
+# }
+# /* impgen.c ends here */
+
+EOF
+    ;;
+  esac
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "${ofile}T" || (rm -f "${ofile}T"; exit 1)
+
+  mv -f "${ofile}T" "$ofile" || \
+    (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T")
+  chmod +x "$ofile"
+fi
+
+
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Prevent multiple expansion
+
+
+
+
+# Extract the first word of "lp", so it can be a program name with args.
+set dummy lp; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:5425: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LPRCOMMAND'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$LPRCOMMAND"; then
+  ac_cv_prog_LPRCOMMAND="$LPRCOMMAND" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_LPRCOMMAND="lp"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+LPRCOMMAND="$ac_cv_prog_LPRCOMMAND"
+if test -n "$LPRCOMMAND"; then
+  echo "$ac_t""$LPRCOMMAND" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+# Extract the first word of "lpr", so it can be a program name with args.
+set dummy lpr; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:5454: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LPRCOMMAND'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$LPRCOMMAND"; then
+  ac_cv_prog_LPRCOMMAND="$LPRCOMMAND" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_LPRCOMMAND="lpr"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+LPRCOMMAND="$ac_cv_prog_LPRCOMMAND"
+if test -n "$LPRCOMMAND"; then
+  echo "$ac_t""$LPRCOMMAND" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+# Extract the first word of "cat", so it can be a program name with args.
+set dummy cat; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:5484: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CATCOMMAND'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CATCOMMAND"; then
+  ac_cv_prog_CATCOMMAND="$CATCOMMAND" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CATCOMMAND="cat"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CATCOMMAND="$ac_cv_prog_CATCOMMAND"
+if test -n "$CATCOMMAND"; then
+  echo "$ac_t""$CATCOMMAND" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+# Extract the first word of "type", so it can be a program name with args.
+set dummy type; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:5513: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CATCOMMAND'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CATCOMMAND"; then
+  ac_cv_prog_CATCOMMAND="$CATCOMMAND" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CATCOMMAND="type"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CATCOMMAND="$ac_cv_prog_CATCOMMAND"
+if test -n "$CATCOMMAND"; then
+  echo "$ac_t""$CATCOMMAND" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+for ac_hdr in stdlib.h unistd.h errno.h assert.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:5546: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5551 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:5556: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/time.h time.h signal.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:5586: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5591 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:5596: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in string.h strings.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:5626: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5631 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:5636: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ break
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+# @start variadic
+case $am_cv_prog_cc_stdc,$ac_cv_header_varargs_h in
+no,)
+	# Non-ANSI compiler, so we must use varargs.h.
+	for ac_hdr in varargs.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:5671: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5676 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:5681: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+	;;
+*,yes)
+	# Parent package is using varargs.h which is incompatible with 
+	# stdarg.h, so we do the same (recheck to generate checking...
+	# message).
+	for ac_hdr in varargs.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:5716: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5721 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:5726: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+	;;
+*)
+	# If stdarg.h is present define HAVE_STDARG_H.
+	for ac_hdr in stdarg.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:5759: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5764 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:5769: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+	;;
+esac
+
+case x$ac_cv_header_stdarg_h$ac_cv_header_varargs_h in
+x*yes*) ;;
+*) { echo "configure: error: Could not find stdarg.h or varargs.h" 1>&2; exit 1; } ;;
+esac
+# @end variadic
+
+echo $ac_n "checking for working const""... $ac_c" 1>&6
+echo "configure:5805: checking for working const" >&5
+if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5810 "configure"
+#include "confdefs.h"
+
+int main() {
+
+/* Ultrix mips cc rejects this.  */
+typedef int charset[2]; const charset x;
+/* SunOS 4.1.1 cc rejects this.  */
+char const *const *ccp;
+char **p;
+/* NEC SVR4.0.2 mips cc rejects this.  */
+struct point {int x, y;};
+static struct point const zero = {0,0};
+/* AIX XL C 1.02.0.0 rejects this.
+   It does not let you subtract one const X* pointer from another in an arm
+   of an if-expression whose if-part is not a constant expression */
+const char *g = "string";
+ccp = &g + (g ? g-g : 0);
+/* HPUX 7.0 cc rejects these. */
+++ccp;
+p = (char**) ccp;
+ccp = (char const *const *) p;
+{ /* SCO 3.2v4 cc rejects this.  */
+  char *t;
+  char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+  *t++ = 0;
+}
+{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+  int x[] = {25, 17};
+  const int *foo = &x[0];
+  ++foo;
+}
+{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+  typedef const int *iptr;
+  iptr p = 0;
+  ++p;
+}
+{ /* AIX XL C 1.02.0.0 rejects this saying
+     "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+  struct s { int j; const int *ap[3]; };
+  struct s *b; b->j = 5;
+}
+{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+  const int foo = 10;
+}
+
+; return 0; }
+EOF
+if { (eval echo configure:5859: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_c_const=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_c_const=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_c_const" 1>&6
+if test $ac_cv_c_const = no; then
+  cat >> confdefs.h <<\EOF
+#define const 
+EOF
+
+fi
+
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:5880: checking for ANSI C header files" >&5
+if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5885 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:5893: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  ac_cv_header_stdc=yes
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 5910 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "memchr" >/dev/null 2>&1; then
+  :
+else
+  rm -rf conftest*
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 5928 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "free" >/dev/null 2>&1; then
+  :
+else
+  rm -rf conftest*
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+if test "$cross_compiling" = yes; then
+  :
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5949 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
+
+EOF
+if { (eval echo configure:5960: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  :
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_header_stdc=no
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
+if test $ac_cv_header_stdc = yes; then
+  cat >> confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
+
+fi
+
+echo $ac_n "checking for size_t""... $ac_c" 1>&6
+echo "configure:5984: checking for size_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5989 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_size_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_size_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_size_t" 1>&6
+if test $ac_cv_type_size_t = no; then
+  cat >> confdefs.h <<\EOF
+#define size_t unsigned
+EOF
+
+fi
+
+echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
+echo "configure:6017: checking whether time.h and sys/time.h may both be included" >&5
+if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6022 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+int main() {
+struct tm *tp;
+; return 0; }
+EOF
+if { (eval echo configure:6031: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_header_time=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_time=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_time" 1>&6
+if test $ac_cv_header_time = yes; then
+  cat >> confdefs.h <<\EOF
+#define TIME_WITH_SYS_TIME 1
+EOF
+
+fi
+
+
+for ac_func in killpg kill
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:6055: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6060 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:6083: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in bcopy memcpy
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:6110: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6115 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:6138: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in bzero memset
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:6165: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6170 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:6193: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ break
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in bcmp memcmp
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:6220: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6225 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:6248: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in index strchr
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:6275: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6280 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:6303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in rindex strrchr
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:6330: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6335 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:6358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in initstate srand
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:6385: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6390 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:6413: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in random rand
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:6440: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6445 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:6468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+for ac_func in calloc
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:6496: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6501 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:6524: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in basename strerror vfprintf
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:6551: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6556 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:6579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"
+fi
+done
+
+
+for ac_func in putenv
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:6608: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6613 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:6636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"
+fi
+done
+
+
+
+
+# @end 5
+# @start 1
+
+
+Xsed="sed -e s/^X//"
+LTLIBOBJS=`echo X"$LIBOBJS"|$Xsed -e "s,\.[^.]* ,.lo ,g;s,\.[^.]*$,.lo,"`
+
+
+
+
+
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs.  It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already.  You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+  case `(ac_space=' '; set | grep ac_space) 2>&1` in
+  *ac_space=\ *)
+    # `set' does not quote correctly, so add quotes (double-quote substitution
+    # turns \\\\ into \\, and sed turns \\ into \).
+    sed -n \
+      -e "s/'/'\\\\''/g" \
+      -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+    ;;
+  *)
+    # `set' quotes correctly as required by POSIX, so do not add quotes.
+    sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+    ;;
+  esac >> confcache
+if cmp -s $cache_file confcache; then
+  :
+else
+  if test -w $cache_file; then
+    echo "updating cache $cache_file"
+    cat confcache > $cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[ 	]*VPATH[ 	]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+DEFS=-DHAVE_CONFIG_H
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+  case "\$ac_option" in
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+    echo "$CONFIG_STATUS generated by autoconf version 2.13"
+    exit 0 ;;
+  -help | --help | --hel | --he | --h)
+    echo "\$ac_cs_usage"; exit 0 ;;
+  *) echo "\$ac_cs_usage"; exit 1 ;;
+  esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "Makefile replace/Makefile metamail/Makefile src/Makefile \
+	   src/metamail/Makefile src/richmail/Makefile bin/Makefile metamail/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@PACKAGE@%$PACKAGE%g
+s%@VERSION@%$VERSION%g
+s%@ACLOCAL@%$ACLOCAL%g
+s%@AUTOCONF@%$AUTOCONF%g
+s%@AUTOMAKE@%$AUTOMAKE%g
+s%@AUTOHEADER@%$AUTOHEADER%g
+s%@MAKEINFO@%$MAKEINFO%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g
+s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g
+s%@MAINT@%$MAINT%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@CC@%$CC%g
+s%@build@%$build%g
+s%@build_alias@%$build_alias%g
+s%@build_cpu@%$build_cpu%g
+s%@build_vendor@%$build_vendor%g
+s%@build_os@%$build_os%g
+s%@LN_S@%$LN_S%g
+s%@OBJEXT@%$OBJEXT%g
+s%@EXEEXT@%$EXEEXT%g
+s%@ECHO@%$ECHO%g
+s%@RANLIB@%$RANLIB%g
+s%@STRIP@%$STRIP%g
+s%@CPP@%$CPP%g
+s%@LIBTOOL@%$LIBTOOL%g
+s%@LIBTOOL_DEPS@%$LIBTOOL_DEPS%g
+s%@LPRCOMMAND@%$LPRCOMMAND%g
+s%@CATCOMMAND@%$CATCOMMAND%g
+s%@LIBOBJS@%$LIBOBJS%g
+s%@LTLIBOBJS@%$LTLIBOBJS%g
+s%@ac_aux_dir@%$ac_aux_dir%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+  if test $ac_beg -gt 1; then
+    sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+  else
+    sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+  fi
+  if test ! -s conftest.s$ac_file; then
+    ac_more_lines=false
+    rm -f conftest.s$ac_file
+  else
+    if test -z "$ac_sed_cmds"; then
+      ac_sed_cmds="sed -f conftest.s$ac_file"
+    else
+      ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+    fi
+    ac_file=`expr $ac_file + 1`
+    ac_beg=$ac_end
+    ac_end=`expr $ac_end + $ac_max_sed_cmds`
+  fi
+done
+if test -z "$ac_sed_cmds"; then
+  ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile replace/Makefile metamail/Makefile src/Makefile \
+	   src/metamail/Makefile src/richmail/Makefile bin/Makefile"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case "$ac_file" in
+  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+  *) ac_file_in="${ac_file}.in" ;;
+  esac
+
+  # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+  # Remove last slash and all that follows it.  Not all systems have dirname.
+  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+    # The file is in a subdirectory.
+    test ! -d "$ac_dir" && mkdir "$ac_dir"
+    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+    # A "../" for each directory in $ac_dir_suffix.
+    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+  else
+    ac_dir_suffix= ac_dots=
+  fi
+
+  case "$ac_given_srcdir" in
+  .)  srcdir=.
+      if test -z "$ac_dots"; then top_srcdir=.
+      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+  *) # Relative path.
+    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+    top_srcdir="$ac_dots$ac_given_srcdir" ;;
+  esac
+
+  case "$ac_given_INSTALL" in
+  [/$]*) INSTALL="$ac_given_INSTALL" ;;
+  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+  esac
+
+  echo creating "$ac_file"
+  rm -f "$ac_file"
+  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+  case "$ac_file" in
+  *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+  *) ac_comsub= ;;
+  esac
+
+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+  sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ 	]*\)#\([ 	]*define[ 	][ 	]*\)'
+ac_dB='\([ 	][ 	]*\)[^ 	]*%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
+ac_uB='\([ 	]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+  CONFIG_HEADERS="metamail/config.h"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case "$ac_file" in
+  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+  *) ac_file_in="${ac_file}.in" ;;
+  esac
+
+  echo creating $ac_file
+
+  rm -f conftest.frag conftest.in conftest.out
+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+  cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h.  And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #undef with comments.  This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[ 	]*#[ 	]*undef[ 	][ 	]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+  ac_lines=`grep -c . conftest.vals`
+  # grep -c gives empty output for an empty file on some AIX systems.
+  if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+  # Write a limited-size here document to conftest.frag.
+  echo '  cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+  echo 'CEOF
+  sed -f conftest.frag conftest.in > conftest.out
+  rm -f conftest.in
+  mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+  rm -f conftest.vals
+  mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+  rm -f conftest.frag conftest.h
+  echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
+  cat conftest.in >> conftest.h
+  rm -f conftest.in
+  if cmp -s $ac_file conftest.h 2>/dev/null; then
+    echo "$ac_file is unchanged"
+    rm -f conftest.h
+  else
+    # Remove last slash and all that follows it.  Not all systems have dirname.
+      ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+      if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+      # The file is in a subdirectory.
+      test ! -d "$ac_dir" && mkdir "$ac_dir"
+    fi
+    rm -f $ac_file
+    mv conftest.h $ac_file
+  fi
+fi; done
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+
+  srcdir=$srcdir
+  ac_cv_func_bzero=$ac_cv_func_bzero
+  ac_cv_func_memset=$ac_cv_func_memset
+  ac_cv_func_strchr=$ac_cv_func_strchr
+  ac_cv_func_strrchr=$ac_cv_func_strrchr
+# @end 5
+  ac_cv_func_basename=$ac_cv_func_basename
+  ac_cv_func_strcspn=$ac_cv_func_strcspn
+  ac_cv_func_strerror=$ac_cv_func_strerror
+  ac_cv_func_strsignal=$ac_cv_func_strsignal
+  ac_cv_func_strspn=$ac_cv_func_strspn
+  ac_cv_func_vfprintf=$ac_cv_func_vfprintf
+  ac_cv_func_waitpid=$ac_cv_func_waitpid
+  ac_cv_header_assert_h=$ac_cv_header_assert_h
+  ac_cv_header_errno_h=$ac_cv_header_errno_h
+  ac_cv_header_stdlib_h=$ac_cv_header_stdlib_h
+  ac_cv_header_stdarg_h=$ac_cv_header_stdarg_h
+  ac_cv_header_string_h=$ac_cv_header_string_h
+  ac_cv_header_strings_h=$ac_cv_header_strings_h
+  ac_cv_header_sys_wait_h=$ac_cv_header_sys_wait_h
+  ac_cv_header_unistd_h=$ac_cv_header_unistd_h
+  ac_cv_header_varargs_h=$ac_cv_header_varargs_h
+  LPRCOMMAND=$LPRCOMMAND
+  CATCOMMAND=$CATCOMMAND
+  host=$host
+# @start 5
+
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+test -z "$CONFIG_HEADERS" || echo timestamp > metamail/stamp-h
+
+  if test -n "$CONFIG_FILES" && test -n "$CONFIG_HEADERS"; then
+    # If both these vars are non-empty, then config.status wasn't run by
+    # automake rules (which always set one or the other to empty).
+    CONFIG_OTHER=${CONFIG_OTHER-METAMAIL/common.h}
+  fi
+  case "$CONFIG_OTHER" in
+  *metamail/common.h*)
+    outfile=metamail/common.h
+    stampfile=metamail/stamp-common
+    tmpfile=${outfile}T
+    dirname="sed s,^.*/,,g"
+
+    echo creating $outfile
+    cat > $tmpfile << _EOF_
+/*  -*- Mode: C -*-
+ * --------------------------------------------------------------------
+ * DO NOT EDIT THIS FILE!  It has been automatically generated
+ * from:    configure.in and `echo $outfile|$dirname`.in
+ * on host: `(hostname || uname -n) 2>/dev/null | sed 1q`
+ * --------------------------------------------------------------------
+ */
+
+#ifndef METAMAIL_COMMON_H
+#define METAMAIL_COMMON_H 1
+
+#include <stdio.h>
+#include <ctype.h>        // ??? ok here
+#include <sys/types.h>
+#include <sys/stat.h>     // ??? ok here
+
+// ??? following ok here without check?
+#include <pwd.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#include <signal.h>
+
+#include <termio.h>
+#include <fcntl.h>
+#include <sys/utsname.h>
+_EOF_
+
+    case "${host}" in
+      *-*-linux-gnu*) cat >> $tmpfile << '_EOF_'
+
+#include <linux/limits.h>
+
+_EOF_
+;;
+    esac
+
+# @end 5
+# @start 4
+    # Add the code to include these headers only if autoconf has
+    # shown them to be present.
+    if test x$ac_cv_header_stdlib_h = xyes; then
+      echo '#include <stdlib.h>' >> $tmpfile
+    fi
+    if test x$ac_cv_header_unistd_h = xyes; then
+      echo '#include <unistd.h>' >> $tmpfile
+    fi
+    if test x$ac_cv_header_sys_wait_h = xyes; then
+      echo '#include <sys/wait.h>' >> $tmpfile
+    fi
+    if test x$ac_cv_header_errno_h = xyes; then
+      echo '#include <errno.h>' >> $tmpfile
+    fi
+    cat >> $tmpfile << '_EOF_'
+
+#ifndef errno
+/* Some sytems #define this! */
+extern int errno;
+#endif
+
+_EOF_
+    if test x$ac_cv_header_string_h = xyes; then
+      echo '#include <string.h>' >> $tmpfile
+    elif test x$ac_cv_header_strings_h = xyes; then
+      echo '#include <strings.h>' >> $tmpfile
+    fi
+
+# *******************
+# start variadic parameters 
+#
+    if test x$ac_cv_header_stdarg_h = xyes \
+	&& test x$ac_cv_header_varargs_h != xyes
+    then
+      cat >> $tmpfile << '_EOF_'
+
+#include <stdarg.h>
+#ifndef VA_START
+#  define VA_START(a, f) va_start(a, f)
+#endif /* VA_START */
+
+_EOF_
+    else
+      cat >> $tmpfile << '_EOF_'
+	
+#include <varargs.h>
+#ifndef VA_START
+#  define VA_START(a, f) va_start(a)
+#endif /* VA_START */
+       
+_EOF_
+    fi
+#
+# end variadic parameters
+# ***********************
+
+    if test x$ac_cv_header_assert_h = xyes; then
+      cat >> $tmpfile << '_EOF_'
+
+#include <assert.h>
+#define METAMAIL_ASSERT assert
+
+_EOF_
+else
+        echo '#define METAMAIL_ASSERT(expr)  ((void) 0)' >> $tmpfile
+    fi
+# @end 4
+# @start 5
+    if test x$ac_cv_func_killpg = xno && \
+       test x$ac_cv_func_kill = xyes; then
+      cat >> $tmpfile << '_EOF_'
+#define killbg(pid, sig) ((int) kill (-(pid), sig))
+_EOF_
+    fi 
+    if test x$ac_cv_func_bcopy = xno && \
+       test x$ac_cv_func_memcpy = xyes; then
+      cat >> $tmpfile << '_EOF_'
+#define bcopy(src, dest, n) ((void) memcpy (dest, src, n))
+_EOF_
+    fi
+    if test x$ac_cv_func_bzero = xno && \
+       test x$ac_cv_func_memset = xyes; then
+      cat >> $tmpfile << '_EOF_'
+#define bzero(buf, bytes) ((void) memset (buf, 0, bytes))
+_EOF_
+    fi
+    if test x$ac_cv_func_bcmp = xno && \
+       test x$ac_cv_func_memcmp = xyes; then
+      echo '#define bcmp memcmp' >> $tmpfile
+    fi
+    if test x$ac_cv_func_index = xno && \
+       test x$ac_cv_func_strchr = xyes; then
+      echo '#define index strchr' >> $tmpfile
+    fi
+    if test x$ac_cv_func_rindex = xno && \
+       test x$ac_cv_func_strrchr = xyes; then
+      echo '#define rindex strrchr' >> $tmpfile
+    fi
+    if test x$ac_cv_func_initstate = xno && \
+       test x$ac_cv_func_srand = xyes; then
+      echo '#define initstate srand' >> $tmpfile
+    fi
+    if test x$ac_cv_func_random = xno && \
+       test x$ac_cv_func_rand = xyes; then
+      echo '#define random rand' >> $tmpfile
+    fi
+
+    # The ugly but portable cpp stuff comes from here
+    infile=$srcdir/metamail/`echo $outfile | sed 's,.*/,,g;s,\..*$,,g'`-h.in
+    sed '/^##.*$/d' $infile >> $tmpfile 
+
+# @end 5
+    ${RM-/bin/rm -f} ${tmpfile}2 2>/dev/null
+    if test x$ac_cv_func_basename = xno; then
+      echo 'extern char *basename PARAMS((const char *path));' >> ${tmpfile}2
+    fi
+    if test x$ac_cv_func_strerror = xno; then
+      echo 'extern char *strerror PARAMS((int err));' >> ${tmpfile}2
+    fi
+    if test x$ac_cv_func_strsignal = xno; then
+      echo 'extern char *strsignal PARAMS((int signo));' >> ${tmpfile}2
+    fi
+    if test x$ac_cv_func_vfprintf = xno; then
+      echo 'extern int vfprintf PARAMS((FILE *file, const char* format, va_list ap));' >> ${tmpfile}2
+    fi
+    if test x$ac_cv_func_waitpid = xno; then 
+	echo 'extern pid_t waitpid PARAMS((pid_t pid, int *pstatus, int options));' >> ${tmpfile}2
+    fi
+
+    if test -f ${tmpfile}2; then
+      cat >> $tmpfile << '_EOF_'
+
+BEGIN_C_DECLS
+_EOF_
+      cat ${tmpfile}2 >> $tmpfile
+      echo 'END_C_DECLS' >> $tmpfile
+      ${RM-/bin/rm -f} ${tmpfile}2 2>/dev/null
+    fi
+
+    if test -n ${LPRCOMMAND}; then
+      echo '#define LPRCOMMAND "'${LPRCOMMAND}'"' >> $tmpfile
+      echo '#define LPRTEMPLATE "'${LPRCOMMAND}' %s"' >> $tmpfile
+    fi
+    if test -n ${CATCOMMAND}; then
+      echo '#define CATCOMMAND "'${CATCOMMAND}'"' >> $tmpfile
+      echo '#define CATTEMPLATE "'${CATCOMMAND}' %s"' >> $tmpfile
+    fi
+
+    case "${host}" in
+      *-*-linux-gnu*) cat >> $tmpfile << '_EOF_'
+#define TMPNAME_MAX NAME_MAX
+static struct termio MyTtyStateIn, MyTtyStateOut;
+
+_EOF_
+;;
+      *) cat >> $tmpfile << '_EOF_'
+
+#define TMPNAME_MAX	1000
+#define NAME_MAX	1000
+static struct sgttyb MyTtyStateIn, MyTtyStateOut;
+
+_EOF_
+;;
+    esac
+
+    cat >> $tmpfile << '_EOF_'
+
+
+#endif /* !METAMAIL_COMMON_H */
+_EOF_
+
+    if cmp -s $tmpfile $outfile; then
+      echo $outfile is unchanged
+      rm -f $tmpfile
+    else
+      mv $tmpfile $outfile
+      touch $stampfile
+    fi
+    ;;
+  esac
+# @start 5
+
+test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h.in
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
--- metamail-2.7.orig/configure.in
+++ metamail-2.7/configure.in
@@ -0,0 +1,361 @@
+dnl Process this file with autoconf to produce a configure script.
+dnl AC_REVISION($Revision: 1.4 $)dnl
+AC_INIT(src/metamail/metamail.c)
+AC_CONFIG_AUX_DIR(config)
+AM_CONFIG_HEADER(metamail/config.h)
+AM_INIT_AUTOMAKE(metamail, 0.0.1)
+AM_MAINTAINER_MODE
+
+AC_CANONICAL_HOST
+
+dnl Checks for programs.
+AC_PROG_CC
+AM_PROG_LIBTOOL
+AC_SUBST(LIBTOOL_DEPS)
+
+AC_CHECK_PROG(LPRCOMMAND, lp, lp)
+AC_CHECK_PROG(LPRCOMMAND, lpr, lpr)
+
+AC_CHECK_PROG(CATCOMMAND, cat, cat)
+AC_CHECK_PROG(CATCOMMAND, type, type)
+
+
+dnl Checks for libraries.
+
+dnl Checks for header files.
+dnl varargscheck ?
+dnl AC_HEADER_STDC
+AC_CHECK_HEADERS(stdlib.h unistd.h errno.h assert.h)
+AC_CHECK_HEADERS(sys/time.h time.h signal.h)
+AC_CHECK_HEADERS(string.h strings.h, break)
+
+# @start variadic
+case $am_cv_prog_cc_stdc,$ac_cv_header_varargs_h in
+no,)
+	# Non-ANSI compiler, so we must use varargs.h.
+	AC_CHECK_HEADERS(varargs.h)
+	;;
+*,yes)
+	# Parent package is using varargs.h which is incompatible with 
+	# stdarg.h, so we do the same (recheck to generate checking...
+	# message).
+	AC_CHECK_HEADERS(varargs.h)
+	;;
+*)
+	# If stdarg.h is present define HAVE_STDARG_H.
+	AC_CHECK_HEADERS(stdarg.h)
+	;;
+esac
+
+case x$ac_cv_header_stdarg_h$ac_cv_header_varargs_h in
+x*yes*) ;;
+*) AC_MSG_ERROR(Could not find stdarg.h or varargs.h, one of which is \
+required for the build process.) ;;
+esac
+# @end variadic
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_TYPE_SIZE_T
+AC_HEADER_TIME
+
+dnl Checks for library functions.
+dnl bzero is ok, 
+AC_CHECK_FUNCS(killpg kill)
+AC_CHECK_FUNCS(bcopy memcpy)
+AC_CHECK_FUNCS(bzero memset, break)
+AC_CHECK_FUNCS(bcmp memcmp)
+AC_CHECK_FUNCS(index strchr)
+AC_CHECK_FUNCS(rindex strrchr)
+AC_CHECK_FUNCS(initstate srand)
+AC_CHECK_FUNCS(random rand)
+
+AC_CHECK_FUNCS(calloc)
+AC_REPLACE_FUNCS(basename strerror vfprintf)
+AC_REPLACE_FUNCS(putenv)
+
+dnl *****************************************
+dnl create a metamail common header file, holding all needed definitions
+dnl for copatiblity
+AC_OUTPUT_COMMANDS([
+  if test -n "$CONFIG_FILES" && test -n "$CONFIG_HEADERS"; then
+    # If both these vars are non-empty, then config.status wasn't run by
+    # automake rules (which always set one or the other to empty).
+    CONFIG_OTHER=${CONFIG_OTHER-METAMAIL/common.h}
+  fi
+  case "$CONFIG_OTHER" in
+  *metamail/common.h*)
+    outfile=metamail/common.h
+    stampfile=metamail/stamp-common
+    tmpfile=${outfile}T
+    dirname="sed s,^.*/,,g"
+
+    echo creating $outfile
+    cat > $tmpfile << _EOF_
+/*  -*- Mode: C -*-
+ * --------------------------------------------------------------------
+ * DO NOT EDIT THIS FILE!  It has been automatically generated
+ * from:    configure.in and `echo $outfile|$dirname`.in
+ * on host: `(hostname || uname -n) 2>/dev/null | sed 1q`
+ * --------------------------------------------------------------------
+ */
+
+#ifndef METAMAIL_COMMON_H
+#define METAMAIL_COMMON_H 1
+
+#include <stdio.h>
+#include <ctype.h>        // ??? ok here
+#include <sys/types.h>
+#include <sys/stat.h>     // ??? ok here
+
+// ??? following ok here without check?
+#include <pwd.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#include <signal.h>
+
+#include <termio.h>
+#include <fcntl.h>
+#include <sys/utsname.h>
+_EOF_
+
+    case "${host}" in
+      *-*-linux-gnu*) cat >> $tmpfile << '_EOF_'
+
+#include <linux/limits.h>
+
+_EOF_
+;;
+    esac
+
+# @end 5
+# @start 4
+    # Add the code to include these headers only if autoconf has
+    # shown them to be present.
+    if test x$ac_cv_header_stdlib_h = xyes; then
+      echo '#include <stdlib.h>' >> $tmpfile
+    fi
+    if test x$ac_cv_header_unistd_h = xyes; then
+      echo '#include <unistd.h>' >> $tmpfile
+    fi
+    if test x$ac_cv_header_sys_wait_h = xyes; then
+      echo '#include <sys/wait.h>' >> $tmpfile
+    fi
+    if test x$ac_cv_header_errno_h = xyes; then
+      echo '#include <errno.h>' >> $tmpfile
+    fi
+    cat >> $tmpfile << '_EOF_'
+
+#ifndef errno
+/* Some sytems #define this! */
+extern int errno;
+#endif
+
+_EOF_
+    if test x$ac_cv_header_string_h = xyes; then
+      echo '#include <string.h>' >> $tmpfile
+    elif test x$ac_cv_header_strings_h = xyes; then
+      echo '#include <strings.h>' >> $tmpfile
+    fi
+
+# *******************
+# start variadic parameters 
+#
+    if test x$ac_cv_header_stdarg_h = xyes \
+	&& test x$ac_cv_header_varargs_h != xyes
+    then
+      cat >> $tmpfile << '_EOF_'
+
+#include <stdarg.h>
+#ifndef VA_START
+#  define VA_START(a, f) va_start(a, f)
+#endif /* VA_START */
+
+_EOF_
+    else
+      cat >> $tmpfile << '_EOF_'
+	
+#include <varargs.h>
+#ifndef VA_START
+#  define VA_START(a, f) va_start(a)
+#endif /* VA_START */
+       
+_EOF_
+    fi
+#
+# end variadic parameters
+# ***********************
+
+    if test x$ac_cv_header_assert_h = xyes; then
+      cat >> $tmpfile << '_EOF_'
+
+#include <assert.h>
+#define METAMAIL_ASSERT assert
+
+_EOF_
+else
+        echo '#define METAMAIL_ASSERT(expr)  ((void) 0)' >> $tmpfile
+    fi
+# @end 4
+# @start 5
+    if test x$ac_cv_func_killpg = xno && \
+       test x$ac_cv_func_kill = xyes; then
+      cat >> $tmpfile << '_EOF_'
+#define killbg(pid, sig) ((int) kill (-(pid), sig))
+_EOF_
+    fi 
+    if test x$ac_cv_func_bcopy = xno && \
+       test x$ac_cv_func_memcpy = xyes; then
+      cat >> $tmpfile << '_EOF_'
+#define bcopy(src, dest, n) ((void) memcpy (dest, src, n))
+_EOF_
+    fi
+    if test x$ac_cv_func_bzero = xno && \
+       test x$ac_cv_func_memset = xyes; then
+      cat >> $tmpfile << '_EOF_'
+#define bzero(buf, bytes) ((void) memset (buf, 0, bytes))
+_EOF_
+    fi
+    if test x$ac_cv_func_bcmp = xno && \
+       test x$ac_cv_func_memcmp = xyes; then
+      echo '#define bcmp memcmp' >> $tmpfile
+    fi
+    if test x$ac_cv_func_index = xno && \
+       test x$ac_cv_func_strchr = xyes; then
+      echo '#define index strchr' >> $tmpfile
+    fi
+    if test x$ac_cv_func_rindex = xno && \
+       test x$ac_cv_func_strrchr = xyes; then
+      echo '#define rindex strrchr' >> $tmpfile
+    fi
+    if test x$ac_cv_func_initstate = xno && \
+       test x$ac_cv_func_srand = xyes; then
+      echo '#define initstate srand' >> $tmpfile
+    fi
+    if test x$ac_cv_func_random = xno && \
+       test x$ac_cv_func_rand = xyes; then
+      echo '#define random rand' >> $tmpfile
+    fi
+
+    # The ugly but portable cpp stuff comes from here
+    infile=$srcdir/metamail/`echo $outfile | sed 's,.*/,,g;s,\..*$,,g'`-h.in
+    sed '/^##.*$/d' $infile >> $tmpfile 
+
+# @end 5
+    ${RM-/bin/rm -f} ${tmpfile}2 2>/dev/null
+    if test x$ac_cv_func_basename = xno; then
+      echo 'extern char *basename PARAMS((const char *path));' >> ${tmpfile}2
+    fi
+    if test x$ac_cv_func_strerror = xno; then
+      echo 'extern char *strerror PARAMS((int err));' >> ${tmpfile}2
+    fi
+    if test x$ac_cv_func_strsignal = xno; then
+      echo 'extern char *strsignal PARAMS((int signo));' >> ${tmpfile}2
+    fi
+    if test x$ac_cv_func_vfprintf = xno; then
+      echo 'extern int vfprintf PARAMS((FILE *file, const char* format, va_list ap));' >> ${tmpfile}2
+    fi
+    if test x$ac_cv_func_waitpid = xno; then 
+	echo 'extern pid_t waitpid PARAMS((pid_t pid, int *pstatus, int options));' >> ${tmpfile}2
+    fi
+
+    if test -f ${tmpfile}2; then
+      cat >> $tmpfile << '_EOF_'
+
+BEGIN_C_DECLS
+_EOF_
+      cat ${tmpfile}2 >> $tmpfile
+      echo 'END_C_DECLS' >> $tmpfile
+      ${RM-/bin/rm -f} ${tmpfile}2 2>/dev/null
+    fi
+
+    if test -n ${LPRCOMMAND}; then
+      echo '#define LPRCOMMAND "'${LPRCOMMAND}'"' >> $tmpfile
+      echo '#define LPRTEMPLATE "'${LPRCOMMAND}' %s"' >> $tmpfile
+    fi
+    if test -n ${CATCOMMAND}; then
+      echo '#define CATCOMMAND "'${CATCOMMAND}'"' >> $tmpfile
+      echo '#define CATTEMPLATE "'${CATCOMMAND}' %s"' >> $tmpfile
+    fi
+
+    case "${host}" in
+      *-*-linux-gnu*) cat >> $tmpfile << '_EOF_'
+#define TMPNAME_MAX NAME_MAX
+static struct termio MyTtyStateIn, MyTtyStateOut;
+
+_EOF_
+;;
+      *) cat >> $tmpfile << '_EOF_'
+
+#define TMPNAME_MAX	1000
+#define NAME_MAX	1000
+static struct sgttyb MyTtyStateIn, MyTtyStateOut;
+
+_EOF_
+;;
+    esac
+
+    cat >> $tmpfile << '_EOF_'
+
+
+#endif /* !METAMAIL_COMMON_H */
+_EOF_
+
+    if cmp -s $tmpfile $outfile; then
+      echo $outfile is unchanged
+      rm -f $tmpfile
+    else
+      mv $tmpfile $outfile
+      touch $stampfile
+    fi
+    ;;
+  esac
+# @start 5
+],[
+  srcdir=$srcdir
+  ac_cv_func_bzero=$ac_cv_func_bzero
+  ac_cv_func_memset=$ac_cv_func_memset
+  ac_cv_func_strchr=$ac_cv_func_strchr
+  ac_cv_func_strrchr=$ac_cv_func_strrchr
+# @end 5
+  ac_cv_func_basename=$ac_cv_func_basename
+  ac_cv_func_strcspn=$ac_cv_func_strcspn
+  ac_cv_func_strerror=$ac_cv_func_strerror
+  ac_cv_func_strsignal=$ac_cv_func_strsignal
+  ac_cv_func_strspn=$ac_cv_func_strspn
+  ac_cv_func_vfprintf=$ac_cv_func_vfprintf
+  ac_cv_func_waitpid=$ac_cv_func_waitpid
+  ac_cv_header_assert_h=$ac_cv_header_assert_h
+  ac_cv_header_errno_h=$ac_cv_header_errno_h
+  ac_cv_header_stdlib_h=$ac_cv_header_stdlib_h
+  ac_cv_header_stdarg_h=$ac_cv_header_stdarg_h
+  ac_cv_header_string_h=$ac_cv_header_string_h
+  ac_cv_header_strings_h=$ac_cv_header_strings_h
+  ac_cv_header_sys_wait_h=$ac_cv_header_sys_wait_h
+  ac_cv_header_unistd_h=$ac_cv_header_unistd_h
+  ac_cv_header_varargs_h=$ac_cv_header_varargs_h
+  LPRCOMMAND=$LPRCOMMAND
+  CATCOMMAND=$CATCOMMAND
+  host=$host
+# @start 5
+])
+# @end 5
+# @start 1
+
+dnl *****************************************
+dnl export of variable settings for Makefiles
+
+dnl for libtool to work LTLIBOJS is needed (currently bug of autoconf)
+Xsed="sed -e s/^X//"
+LTLIBOBJS=`echo X"$LIBOBJS"|[$Xsed -e "s,\.[^.]* ,.lo ,g;s,\.[^.]*$,.lo,"]`
+AC_SUBST(LTLIBOBJS)
+
+dnl the aux dir (for holding config & autodenerated stuff)
+AC_SUBST(ac_aux_dir)
+AC_SUBST(LPRCOMMAND)
+AC_SUBST(CATCOMMAND)
+
+AC_OUTPUT([Makefile replace/Makefile metamail/Makefile src/Makefile \
+	   src/metamail/Makefile src/richmail/Makefile bin/Makefile],
+[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h.in])
--- metamail-2.7.orig/debian/mimeit.1
+++ metamail-2.7/debian/mimeit.1
@@ -0,0 +1,28 @@
+.TH MIMEIT 1 "1998 March 1st" "METAMAIL" "Debian Linux Manual"
+.SH NAME
+mimeit \- base64-encode stdin and mail it
+.SH SYNOPSIS
+.B mimeit
+.I content-type recipient subject
+.RI [ splitmail-options ]
+.SH "DESCRIPTION"
+This manual page documents briefly the
+.B mimeit
+command.
+This manual page was written for the
+.B Debian GNU/Linux
+distribution (but may be used by others), because the original
+program does not have a manual page.
+.PP
+.B mimeit
+base64-encodes the message read from stdin and sends it off
+using
+.BR splitmail (1).
+It will pass all but the first three parameters to \fBsplitmail\fR(1).
+.SH AUTHOR
+.B mimeit
+is part of metamail package.  Manual page added by Herbert Xu
+and fixed by Michael Moerz <e9625136@stud3.tuwien.ac.at>.
+.SH SEE ALSO
+.PP
+\fBMIME\fR(1), \fBsplitmail\fR(1), \fBmunpack\fR(1), \fBmetamail\fR(1)
--- metamail-2.7.orig/debian/mime
+++ metamail-2.7/debian/mime
@@ -0,0 +1,7 @@
+text/plain; shownonascii iso-8859-1 %s; description="Plain ASCII Text"; test=test "$(echo %{charset} | tr "[A-Z]" "[a-z]")" = iso-8859-1 -a "$DISPLAY" != ""
+text/richtext; richtext %s; description="Richtext"; copiousoutput; priority=4
+text/richtext; shownonascii iso-8859-1 -e richtext -p %s; description="Richtext"; copiousoutput; test=test "$(echo %{charset} | tr "[A-Z]" "[a-z]")" = iso-8859-1 -a "$DISPLAY" != ""
+text/enriched; richtext -e %s; description="Enriched Text"; copiousoutput; priority=4
+text/enriched; shownonascii iso-8859-1 -e richtext -e -p %s; description="Enriched Text"; copiousoutput; test=test "$(echo %{charset} | tr "[A-Z]" "[a-z]")" = iso-8859-1 -a "$DISPLAY" != ""
+message/partial; showpartial %s %{id} %{number} %{total}; description="An incomplete message"
+message/external-body; showexternal %s %{access-type} %{name} %{site} %{directory} %{mode} %{server}; needsterminal; description="A reference to data stored in an external location"; composetyped="extcompose %s"
--- metamail-2.7.orig/debian/changelog
+++ metamail-2.7/debian/changelog
@@ -0,0 +1,435 @@
+metamail (2.7-52) unstable; urgency=low
+
+  * QA Group upload.
+  * Set Standards-Version to 3.7.2.
+  * Set DH_COMPAT to 5.
+  * Fixed "Does not provide filenames for attachments", closes:
+    #321968. Patch by Immanuel Halupczok <debian-bugs@karimmi.de>.
+  * Fixed "dumps core with -w option", closes: #357163.
+    Patch by Justin Pryzby <justinpryzby@users.sourceforge.net>.
+
+ -- Anibal Monsalve Salazar <anibal@debian.org>  Wed, 19 Jul 2006 12:53:40 +1000
+
+metamail (2.7-51) unstable; urgency=high
+
+  * QA upload.
+  * Fixed "[CVE-2006-0709] crashes with very long boundaries in
+    messages", closes: #352482, #353539. Patch thanks to
+    Ulf Harnhammar <metaur@telia.com>.
+
+ -- Anibal Monsalve Salazar <anibal@debian.org>  Thu, 23 Feb 2006 09:17:36 +1100
+
+metamail (2.7-50) unstable; urgency=low
+
+  * QA upload.
+  * Automatically update config.sub and config.guess from autotools-dev.
+    Closes: #338566.
+  * man/metamail.1: Fix search path formatting.
+
+ -- Matej Vela <vela@debian.org>  Fri, 11 Nov 2005 07:42:03 +0100
+
+metamail (2.7-49) unstable; urgency=low
+
+  * QA upload.
+  * bin/uuenpipe, bin/uudepipe: Properly handle unreadable files,
+    filenames beginning with "-", and filenames containing whitespace.
+    (These scripts were not meant to take options.)  Closes: #273195.
+  * src/metamail/mailto.c (GetLineMalloced): Fix segfault caused by
+    freeing static storage.  Closes: #300756.
+  * man/metamail.1: Document the -E option.  Closes: #177823.
+  * man/richtext.1: Document the -e option.  Closes: #296120.
+  * Conforms to Standards version 3.6.2.
+
+ -- Matej Vela <vela@debian.org>  Fri, 19 Aug 2005 11:25:02 +0200
+
+metamail (2.7-48) unstable; urgency=low
+
+  * QA Group upload by Javier Fernandez-Sanguino
+  * Fix typos in manpages with patches provided by A Costa (Closes: #311450,
+    #311451, #311452, #311453)
+  * Fix use of temporary files in showpartial so that uses cannot introduce
+    a DOS through the use of hard links. Temporary files are created with
+    mktemp and their filename is stored in ~/.metamail_treeroot (Closes:
+    #321473)
+
+ -- Javier Fernandez-Sanguino Pen~a <jfs@computer.org>  Wed, 17 Aug 2005 00:17:20 +0200
+
+metamail (2.7-47) unstable; urgency=low
+
+  * QA Group upload by Anibal Monsalve Salazar.
+  * Fixed "Add/Improve SEE ALSO section for splitmail/mimeit" (Closes:
+    #245647). Patch by Helge Kreutzmann <kreutzm@itp.uni-hannover.de>.
+  * Fixed "8-bit encoding is supported by metamail but not by metasend script"
+    (Closes: #285914). Patch by Sergey Kogan <kogan@sklad.bacon.ru>.
+  * Fixed "additional option when handling unrecognized content types"
+    (Closes: #249823). Patch by Daniel Kraft <da_kraft@web.de>.
+  * Fixed "debug message 'pre access' left in released version
+    (Closes: #184410). Patch by <pmaydell@chiark.greenend.org.uk>.
+
+ -- Anibal Monsalve Salazar <anibal@debian.org>  Sun, 13 Feb 2005 10:43:55 +1100
+
+metamail (2.7-46) unstable; urgency=low
+
+  * QA Group upload orphaning this package
+  * Incorporates previous NMUs (closes: #164074, #185005, #233935)
+  * debian/control: make build-dependency on debhelper versioned
+
+ -- Andrew Pollock <apollock@debian.org>  Tue,  9 Nov 2004 22:14:08 +1100
+
+metamail (2.7-45.3) unstable; urgency=medium
+
+  * Non-maintainer upload by the Security Team
+  * Adjust the patch since Christian 'Naddy' Weisgerber discovered an
+    overzealous use of sizeof().
+
+ -- Martin Schulze <joey@infodrom.org>  Tue,  2 Mar 2004 20:08:51 +0100
+
+metamail (2.7-45.2) unstable; urgency=high
+
+  * NMU
+  * [src/metamail/metamail.c, src/metamail/splitmail.c] Address CAN-2004-0104
+    and CAN-2004-0105 (format string vulnerabilities and buffer overflows).
+    (Addresses #233640 for sid)
+  * [bin/audiocompose] Quote file reference.
+  * [metamail/splitmail.c] Use /usr/sbin/sendmail rather than
+    /usr/lib/sendmail.
+
+ -- J.H.M. Dassen (Ray) <jdassen@debian.org>  Fri, 20 Feb 2004 21:22:16 +0100
+
+metamail (2.7-45.1) unstable; urgency=low
+
+  * NMU
+  * Fixed FTBFS: (Closes: #164074)
+    * [configure.in] Added AM_MAINTAINER_MODE.
+    * [debian/rules] Introduced "source-updates" target.
+    * [debian/control] Dropped "libtool" and "automake" build dependencies.
+    * Regenerated auto* files.
+  * [bin/audiosend] Fixed shell syntax by adding a 'then'.
+  * [debian/control] Removed full stop from the one line description.
+
+ -- J.H.M. Dassen (Ray) <jdassen@debian.org>  Sun, 16 Mar 2003 13:38:42 +0100
+
+metamail (2.7-45) unstable; urgency=low
+
+  * eliminated nasty tmpfile bug that caused removal of temporary files
+    though they were in use by processes that have been backgrounded by
+    metamail. (Closes: #141966)
+
+ -- Michael Moerz <mikem@debian.org>  Mon, 15 Apr 2002 11:07:17 +0200
+
+metamail (2.7-44) unstable; urgency=low
+
+  * renamed mmencode reference from metamail manpage to mimencode
+    (Closes: #137347)
+  * removed mailcap manpage from metamail package so that can go into
+    the mime-support package (Closes:  #139989)
+
+ -- Michael Moerz <mikem@debian.org>  Wed,  3 Apr 2002 02:24:53 +0200
+
+metamail (2.7-43) unstable; urgency=low
+
+  * fixed 64bit architecture problems caused by missing prototypes of
+    functions. The actual pactch was developed by 
+    John R.Daily" <jdaily@progeny.com> (Closes: #126109)
+  * fixed usage message of mimencode by using a patch supplied by
+    David Fries <dfries@mail.win.org> (Closes: #119075)
+
+ -- Michael Moerz <mikem@debian.org>  Sat, 22 Dec 2001 00:35:19 +0100
+
+metamail (2.7-42) unstable; urgency=low
+
+  * fixed bug that caused mailto to honour newlines incorrectly when
+    mimetypes are asked for and checked.
+
+ -- Michael Moerz <mikem@debian.org>  Mon, 15 Oct 2001 22:11:35 +0200
+
+metamail (2.7-41) unstable; urgency=low
+
+  * fixed a minor bug regarding the man page of metamail saying /usr/ucb/reset
+    and not /usr/bin/reset (Closes: #110889)
+  * fixed broken showpartial (Closes: #107538)
+
+ -- Michael Moerz <mikem@debian.org>  Sat,  1 Sep 2001 20:32:01 +0200
+
+metamail (2.7-40) unstable; urgency=low
+
+  * Removed non functional downwards compatiblity code for older
+    mime-support which called install-mime when the previous metamail
+    version was less than 2-7.34. (Closes: #100993)
+  * hardened dependency to mime-support (version 3.11-1 or higher has
+    to be installed now)
+
+ -- Michael Moerz <mikem@debian.org>  Sat, 16 Jun 2001 13:48:12 +0200
+
+metamail (2.7-39) unstable; urgency=low
+
+  * fixed a bug that created a segfault when saving an attachment.
+    (Closes: #88766)
+
+ -- Michael Moerz <e9625136@stud3.tuwien.ac.at>  Tue, 20 Mar 2001 20:52:20 +0100
+
+metamail (2.7-38) unstable; urgency=low
+
+  * stupid me has again missed a build depends for libncurses-dev.
+    This is fixed now. (Closes: #86559)
+
+ -- Michael Moerz <e9625136@stud3.tuwien.ac.at>  Sun, 25 Feb 2001 17:05:45 +0100
+
+metamail (2.7-37) unstable; urgency=low
+
+  * Fixed broken build caused by not using a shell for interpreting
+    the bootstrap script (Closes: #85764).
+  * changed rules file so that not only the existence of Makefile
+    is checked, but of Makefile.in too and the decision is made
+    to use make clean or make destclean (Makefile.in present).
+  * fixed build depends to enlist libtool & automake too.
+    (Closes: #86128)
+  * fixed disappearing of mimencode (Closes: #86083)
+
+ -- Michael Moerz <e9625136@stud3.tuwien.ac.at>  Tue, 13 Feb 2001 14:08:20 +0100
+
+metamail (2.7-36) unstable; urgency=low
+
+  * Fixed broken showpartial where a variable was not set correctly
+    (nullified) and that caused that showpartial didn't work.
+    (Closes: #58614)
+  * Fixed mimeit manpage refering to mm package instead of metamail
+    (Closes: #63033)
+  * added a README.Debian pointing out the debian specific
+    modifications to the package
+  * Fixed the leaving tmp-files behind bug. So now metamail removes
+    all files it generates in /tmp before it terminates.
+    (Closes: #39011)
+  * DH_COMPAT=2 is now in place and functional
+  * converted build-process and .c and .h files to use autoconf and
+    automake. (Now the package will build under woody again.) 
+
+ -- Michael Moerz <e9625136@stud3.tuwien.ac.at>  Thu, 18 Jan 2001 04:26:05 +0100
+
+metamail (2.7-35) unstable; urgency=low
+
+  * Fixed a typo in metasend that resulted in Content-Description
+    being blank when -n wasn't set. (Closes: #70761)
+
+ -- Teemu Hukkanen <tjhukkan@iki.fi>  Sun, 10 Sep 2000 21:58:00 +0300
+
+metamail (2.7-34) frozen unstable; urgency=low
+
+  * The install-all target tried to strip shell scripts, plus several
+    additional flaws, which prevented building, closes: #55260.
+  * Updated for newer mime-support, closes: #47097. Downgraded
+    mime-support dependency to a recommendation, and removed useless
+    version (as the new scheme is used, and 2.02-1 is too old for it).
+  * Updated for Policy 3.1.1.
+
+ -- Josip Rodin <jrodin@jagor.srce.hr>  Tue,  8 Feb 2000 21:15:19 +0100
+
+metamail (2.7-33) unstable; urgency=low
+
+  * Orphaning metamail.
+
+ -- Herbert Xu <herbert@debian.org>  Sat, 20 Nov 1999 20:33:36 -0600
+
+metamail (2.7-32) unstable; urgency=low
+
+  * Fixed postinst script where it didn't add mailcap entries for an initial
+    install.
+  * Don't warn about wild cards in mailcap (fixes #30910).
+  * Use $() instead of `` for command substitution (fixes #33487).
+    Note that metamail does %{} substitutions with the correct quoting.
+    Indeed, it filters out characters like ` so there is no problem even if
+    this fix were not there.  But other applications that currently do not do
+    the required quoting should do so.
+    Also, all packages that add entries to mailcap should check their entries
+    and replace all `` with % substitutions inside with $() so as to avoid
+    the obscure shell rule that `` is terminated by a un-backslashed back-
+    quote.  Indeed, if this back-quote occurs within single or double quotes,
+    the result is undefined.
+
+ -- Herbert Xu <herbert@debian.org>  Sun, 14 Mar 1999 12:58:05 +1100
+
+metamail (2.7-31) frozen unstable; urgency=low
+
+  * Uploaded to slink.
+
+ -- Herbert Xu <herbert@debian.org>  Sun, 15 Nov 1998 15:11:52 +1100
+
+metamail (2.7-30) unstable; urgency=low
+
+  * Use lpr instead of lp for linux (fixes #27259).
+  * Removed all traces of mmencode (fixes #28746).
+  * Rebuilt with libncruses4.
+
+ -- Herbert Xu <herbert@debian.org>  Sat, 31 Oct 1998 15:16:13 +1100
+
+metamail (2.7-29) unstable; urgency=medium
+
+  * Applied security patch from Topi Miettinen (fixes #26877).
+
+ -- Herbert Xu <herbert@debian.org>  Tue, 22 Sep 1998 14:29:27 +1000
+
+metamail (2.7-28) frozen unstable; urgency=high
+
+  * Fixed showpartial (fixes #23595).
+
+ -- Herbert Xu <herbert@debian.org>  Thu, 18 Jun 1998 09:41:50 +1000
+
+metamail (2.7-27) unstable; urgency=low
+
+  * Fixed shownonascii (fixes #19862).
+  * Manually add mimencode.1.
+
+ -- Herbert Xu <herbert@debian.org>  Wed, 18 Mar 1998 21:06:39 +1100
+
+metamail (2.7-26) unstable; urgency=low
+
+  * Added -e to all shell scripts (fixes #19802).
+  * Removed #!/bin/sh header from mime.noinstall.
+
+ -- Herbert Xu <herbert@debian.org>  Tue, 17 Mar 1998 21:22:25 +1100
+
+metamail (2.7-25) unstable; urgency=low
+
+  * Use sensible-pager instead of pager.
+  * Upgraded to Standard Version 2.4.0.0.
+  * Removed
+    . mailserver
+    . mailto-hebrew
+    . rcvAppSingle
+    . richtoatk
+    . sndAppSingle
+    . sun-audio-file
+    . sun-message
+    . sun-to-mime
+    . sun2mime
+    as they were either not functional or useless and without a manpage.
+  * Added manpages to mimeit, uuencode and uudecode (fixes #6332).
+  * Converted to debhelper.
+  * Moved mailcap from section 4 to section 5.
+
+ -- Herbert Xu <herbert@debian.org>  Mon,  2 Mar 1998 15:46:44 +1100
+
+metamail (2.7-24) unstable; urgency=high
+
+  * Use tempfile for temporary files.
+  * Removed sun-message.csh.
+
+ -- Herbert Xu <herbert@debian.org>  Wed, 15 Oct 1997 10:29:16 +1000
+
+metamail (2.7-23) unstable; urgency=low
+
+  * Fixed uudepipe (#12371).
+
+ -- Herbert Xu <herbert@debian.org>  Tue,  2 Sep 1997 21:37:01 +1000
+
+metamail (2.7-22) unstable; urgency=low
+
+  * Recompiled with libc6.
+  * Removed recommendation of xv | xloadimage (#9706).
+
+ -- Herbert Xu <herbert@debian.org>  Sat, 21 Jun 1997 16:17:29 +1000
+
+metamail (2.7-21) stable frozen unstable; urgency=high
+
+  * Recompiled with gcc-2.7.2.1-8.
+
+ -- Herbert Xu <herbert@debian.org>  Sun, 4 May 1997 23:16:22 +1000
+
+metamail (2.7-20) stable frozen unstable; urgency=high
+
+  * Applyed Olaf Kirch's patch for a possible security hole.
+  * Changed all /usr/lib/sendmail to /usr/sbin/sendmail.
+
+ -- Herbert Xu <herbert@debian.org>  Wed, 30 Apr 1997 16:30:51 +1000
+
+metamail (2.7-19) unstable; urgency=low
+
+  * Be smarter about running install-mime when upgrading (#7859).
+  * Changed links to undocumented.7 to undocumented.7.gz.
+
+ -- Herbert Xu <herbert@debian.org>  Mon, 10 Mar 1997 19:44:54 +1100
+
+metamail (2.7-18) unstable; urgency=low
+
+  * Substitued which for whence (#7233).
+
+ -- Herbert Xu <herbert@debian.org>  Tue, 11 Feb 1997 17:34:39 +1100
+
+metamail (2.7-17) unstable; urgency=low
+
+  * New maintainer.
+  * Changed all "RM=/bin/rm" to "RM=rm" in Makefiles.
+  * Modified debian/rules and Makefiles to use debstd.
+  * Adding undocumented links.
+  * Adding #!/bin/sh to shell scripts to help identification.
+  * Fixed bug #6104 and removed extraneous blanks in mailcap.4.
+
+ -- Herbert Xu <herbert@debian.org>  Wed, 15 Jan 1997 20:45:07 +1100
+
+metamail (2.7-16) unstable; urgency=LOW
+
+  * Fixed postinst (Bug#5606)
+
+ -- Michael Meskes <meskes@debian.org>  Thu, 5 Dec 1996 14:55:23 +0100
+
+metamail (2.7-15) frozen unstable; urgency=MEDIUM
+
+  * sun2mime now calls /usr/bin/nawk (Bug#5488)
+
+ -- Michael Meskes <meskes@debian.org>  Tue, 19 Nov 1996 09:37:17 +0100
+
+metamail (2.7-14) frozen unstable; urgency=MEDIUM
+
+  * Corrected metasend (and other scripts) to not call echo-n (Bug#5397).
+  * remove echo-n from distribution
+
+ -- Michael Meskes <meskes@debian.org>  Wed, 13 Nov 1996 17:25:19 +0100
+
+metamail (2.7-13) unstable; urgency=LOW
+
+  * Cleaned up postinst (Bug#4720). Other install-mime calls are now
+  * installed just as a doc file.
+
+ -- Michael Meskes <meskes@debian.org>  Sat, 12 Oct 1996 15:15:50 +0200
+
+metamail (2.7-12) unstable; urgency=LOW
+
+  * Added 'Recommends: sharutils' (Bug#4616)
+
+ -- Michael Meskes <meskes@debian.org>  Mon, 30 Sep 1996 14:01:30 +0200
+
+metamail (2.7-11) unstable; urgency=LOW
+
+  * Moved Bourne shell scripts into bin directory, so dpkg-source works.
+  * Fixed showpicture to not use a geometry
+
+ -- Michael Meskes <meskes@debian.org>  Sun, 29 Sep 1996 13:52:41 +0200
+
+metamail (2.7-10) unstable; urgency=LOW
+
+  * Fixed that silly naming bug that caused postinst to be installed as
+  * binary in /usr/bin (bug#4425)
+
+ -- Michael Meskes <meskes@debian.org>  Sat, 7 Sep 1996 12:59:13 +0200
+
+metamail (2.7-9) unstable; urgency=LOW
+
+  * Corrected some minor bugs in debian/ directory and adjusted debian/rules
+  * accordingly. Conversion to new packaging scheme is now completed.
+
+ -- Michael Meskes <meskes@debian.org>  Sun, 1 Sep 1996 11:39:03 +0200
+
+metamail (2.7-8) unstable; urgency=LOW
+
+  * Corrected font name in postinst
+  * Corrected rules file to not install /usr/doc/copyright/README
+
+ -- Michael Meskes <meskes@debian.org>  Thu, 29 Aug 1996 17:11:43 +0200
+
+metamail (2.7-7) unstable; urgency=LOW
+
+  * Corrected dependency (Bug#4305)
+  * New packaging scheme
+
+ -- Michael Meskes <meskes@debian.org>  Wed, 28 Aug 1996 14:05:10 +0200
+
--- metamail-2.7.orig/debian/control
+++ metamail-2.7/debian/control
@@ -0,0 +1,23 @@
+Source: metamail
+Section: mail
+Priority: optional
+Maintainer: Debian QA Group <packages@qa.debian.org>
+Build-Depends: debhelper (>= 5), autotools-dev, libncurses-dev
+Standards-Version: 3.7.2
+
+Package: metamail
+Section: mail
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Recommends: sharutils, mime-support (>=3.11-1)
+Description: implementation of MIME
+ Metamail is an implementation of Multi-purpose Internet Mail
+ Extensions (MIME), a proposed standard for multimedia electronic
+ mail on the Internet.
+ .
+ Metamail is configurable and extensible via the "mailcap" mechanism
+ described in an informational RFC that is a companion to the MIME
+ document.  Metamail can be used to turn virtually any mail reader
+ program into a multimedia mail reader.  For information about how
+ to change mail readers so that they can use Metamail, please read
+ the file `/usr/share/doc/metamail/mailers.txt.gz'.
--- metamail-2.7.orig/debian/mimencode.1
+++ metamail-2.7/debian/mimencode.1
@@ -0,0 +1,52 @@
+.TH MIMENCODE 1 "Release 1" "Bellcore Prototype"
+.SH NAME
+mimencode - Translate to and from mail-oriented encoding formats
+.SH SYNOPSIS
+.ta 8n
+\fBmimencode\fP	[-u] [-b] [-q] [-p] [file name] [-o outputfile]
+.br
+.SH DESCRIPTION
+The
+.I mimencode
+program simply converts a byte stream into (or out of) one of the standard mail encoding formats defined by MIME, the proposed standard for internet multimedia mail formats.  Such an encoding is necessary because binary data cannot be sent through the mail.  The encodings understood by mimencode are preferable to the use of the uuencode/uudecode programs, for use in mail, in several respects that were important to the authors of MIME.
+
+By default, mimencode reads standard input, and sends a "base64" encoded version of the input to standard output.
+
+The (really not necessary) "-b" option tells mimencode to use the "base64" encoding.
+
+The "-q" option tells mimencode to use the "quoted-printable" encoding instead of base64.
+
+The "-u" option tells mimencode to 
+.I
+decode
+the standard input rather than encode it.  
+
+The "-p" option tells mimencode to translate decoded CRLF sequences into the local newline convention during decoding and to do the reverse during encoding.  This option is only meaningful when  -b (base64 encoding) is in effect.
+
+If a file name argument is given, input is read from that file rather than from standard input.
+
+The "-o" option, which must be followed by a file name, sends output to the named file rather than to standard output.
+.SH RATIONALE
+.I
+Mimencode
+is intended to be a replacement for 
+.I
+uuencode
+for mail and news use.  The reason is simple:  uuencode doesn't work very well in a number of circumstances and ways.  In particular, uuencode uses characters that don't translate well across all mail gateways (particularly ASCII <-> EBCDIC gateways).  Also, uuencode is not standard -- there are several variants floating around, encoding and decoding things in different and incompatible ways, with no "standard" on which to base an implementation.  Finally, uuencode does not generally work well in a pipe, although some variants have been modified to do so.  Mimencode implements the encodings which were defined for MIME as uuencode replacements, and should be considerably more robust for email use.
+.SH SEE ALSO
+metamail(1), mailto(1)
+.SH COPYRIGHT
+Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
+
+Permission to use, copy, modify, and distribute this material 
+for any purpose and without fee is hereby granted, provided 
+that the above copyright notice and this permission notice 
+appear in all copies, and that the name of Bellcore not be 
+used in advertising or publicity pertaining to this 
+material without the specific, prior written permission 
+of an authorized representative of Bellcore.  BELLCORE 
+MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
+OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
+WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+.SH AUTHOR
+Nathaniel S. Borenstein
--- metamail-2.7.orig/debian/rules
+++ metamail-2.7/debian/rules
@@ -0,0 +1,115 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
+
+# Uncomment this to turn on verbose mode.
+export DH_VERBOSE=1
+
+# the debhelper compatiblity version
+export DH_COMPAT=5
+
+export INTERNAL_DESTDIR=debian/tmp
+
+MAJOR=0
+MINOR=0.0
+
+source-updates:
+	dh_testdir
+	sh bootstrap
+
+build: build-stamp
+build-stamp:
+	dh_testdir
+	ln -sf /usr/share/misc/config.sub /usr/share/misc/config.guess config
+	chmod +x ./configure
+	./configure --prefix=/usr
+	$(MAKE)
+	touch $@
+
+clean:
+	dh_testdir
+	dh_testroot
+	-if test -e Makefile; then \
+	  if test -e Makefile.in; then \
+		$(MAKE) distclean; \
+	  else \
+		$(MAKE) clean; \
+	  fi \
+	 fi
+	rm -f config/config.sub config/config.guess
+	dh_clean build-stamp install-stamp mimencode.1
+
+install: install-stamp
+install-stamp: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	-$(MAKE) install DESTDIR=`pwd`/$(INTERNAL_DESTDIR)
+
+	cd $(INTERNAL_DESTDIR)/usr/bin && rm sun-message.csh mailserver \
+	  rcvAppleSingle richtoatk sndAppleSingle sun-audio-file \
+          sun-message sun-to-mime sun2mime mailto-hebrew
+
+	touch $@
+
+binary-indep:
+# No arch-indep packages to be built here.
+
+binary-arch: build install metamail
+
+
+metamail: build install
+	dh_testdir -pmetamail
+	dh_testroot -pmetamail
+
+	dh_installdirs -pmetamail
+	dh_movefiles -pmetamail
+	cp man/mmencode.1 debian/mimencode.1
+
+	dh_link -pmetamail usr/lib/libmetamail.so.$(MAJOR).$(MINOR) \
+	  usr/lib/libmetamail.so.$(MAJOR)
+
+	dh_installdocs -pmetamail CREDITS README mailers.txt \
+	  debian/mime.noinstall
+	dh_installchangelogs -pmetamail
+	dh_installmime -pmetamail
+	dh_installmanpages -pmetamail mmencode.1 mailto-hebrew.1 mailcap.4 \
+	    mailcap.5
+	dh_strip -pmetamail
+	dh_compress -pmetamail
+	dh_fixperms -pmetamail
+	dh_makeshlibs -pmetamail
+	dh_installdeb -pmetamail
+	dh_shlibdeps -pmetamail -l$(shell pwd)/debian/metamail/usr/lib
+	dh_gencontrol -pmetamail -- -isp
+	dh_md5sums -pmetamail
+	dh_builddeb -pmetamail
+
+#libmetamail0: build install
+#	dh_testdir -plibmetamail0
+#	dh_testroot -plibmetamail0
+
+#	dh_installdirs -plibmetamail0
+#	dh_movefiles -plibmetamail0
+
+#	dh_link -plibmetamail0 usr/lib/libmetamail.so.$(MAJOR).$(MINOR) \
+#	  usr/lib/libmetamail.so.$(MAJOR)
+
+#	dh_installdocs -plibmetamail0
+#	dh_installchangelogs -plibmetamail0
+#	dh_strip -plibmetamail0
+#	dh_compress -plibmetamail0
+#	dh_fixperms -plibmetamail0
+#	dh_installdeb -plibmetamail0
+#	dh_shlibdeps -plibmetamail0
+#	dh_gencontrol -plibmetamail0
+#	dh_makeshlibs -plibmetamail0 -V
+#	dh_md5sums -plibmetamail0
+#	dh_builddeb -plibmetamail0
+
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary
+
+
--- metamail-2.7.orig/debian/metamail.files
+++ metamail-2.7/debian/metamail.files
@@ -0,0 +1,3 @@
+usr/bin
+usr/lib/libmetamail.so.*
+
--- metamail-2.7.orig/debian/shlibs.local
+++ metamail-2.7/debian/shlibs.local
@@ -0,0 +1 @@
+libmetamail 0 
--- metamail-2.7.orig/debian/mime.noinstall
+++ metamail-2.7/debian/mime.noinstall
@@ -0,0 +1,5 @@
+image/*; showpicture -viewer xv %s; description="All Graphic Images"
+image/*; showpicture -viewer "xloadimage -view -quiet" %s; description="All Graphic Images"
+audio/*; showaudio %s; description="All Audio Subtypes"
+audio/basic; showaudio %s; compose="audiocompose %s"; edit="audiocompose %s"; description="An Audio Fragment"
+audio-file; sun-audio-file %s; description="Sun Audio Message"
--- metamail-2.7.orig/debian/README.Debian
+++ metamail-2.7/debian/README.Debian
@@ -0,0 +1,12 @@
+This is the Debian GNU/Linux prepackaged version of the metamail package.
+
+It installs only a basis of the scripts included in the original metamail
+package. Excluded are Apple specifics (rcvAppleSingle, sndAppleSingle),
+sun specifics (sun-message.csh, sun-audio-file, sun-message, sun-to-mime,
+sun2mime), hebrew specifics (mailto-hebrew), mailserver extensions 
+(mailserver), binary wrapper extensions for mimeencode (mmencode) and richtoak.
+
+I had to fix the source by adding a doublinked list that stores all opened
+tmp files. This list is used at before the program terminates so that all
+tmp files get properly removed.
+
--- metamail-2.7.orig/debian/copyright
+++ metamail-2.7/debian/copyright
@@ -0,0 +1,37 @@
+This is the Debian GNU/Linux prepackaged version of Metamail.
+
+This package was put together by Michael Meskes <meskes@debian.org>,
+from sources obtained from:
+ ftp.bellcore.com:/pub/nsb/mm2.7.tar.Z and /pub/nsb/contrib2.7.tar.Z
+
+This package was then worked on by Herbert Xu <herbert@debian.org>.
+
+****************************************************************
+Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
+
+Permission to use, copy, modify, and distribute this material 
+for any purpose and without fee is hereby granted, provided 
+that the above copyright notice and this permission notice 
+appear in all copies, and that the name of Bellcore not be 
+used in advertising or publicity pertaining to this 
+material without the specific, prior written permission 
+of an authorized representative of Bellcore.  BELLCORE 
+MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
+OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
+WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+****************************************************************
+
+Most scripts are:
+
+# Conversion from C shell to Bourne shell by Z-Code Software Corp.
+# Conversion Copyright (c) 1992 Z-Code Software Corp.
+# Permission to use, copy, modify, and distribute this material
+# for any purpose and without fee is hereby granted, provided
+# that the above copyright notice and this permission notice
+# appear in all copies, and that the name of Z-Code Software not
+# be used in advertising or publicity pertaining to this
+# material without the specific, prior written permission
+# of an authorized representative of Z-Code.  Z-CODE SOFTWARE
+# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
+# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
+# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
--- metamail-2.7.orig/config/depcomp
+++ metamail-2.7/config/depcomp
@@ -0,0 +1,411 @@
+#! /bin/sh
+
+# depcomp - compile a program generating dependencies as side-effects
+# Copyright 1999, 2000 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+# `libtool' can also be set to `yes' or `no'.
+
+depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  This file always lives in the current directory.
+  # Also, the AIX compiler puts `$object:' at the start of each line;
+  # $object doesn't have directory information.
+  stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  outname="$stripped.o"
+  if test "$libtool" = yes; then
+    "$@" -Wc,-M
+  else
+    "$@" -M
+  fi
+
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+
+  if test -f "$tmpdepfile"; then
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+tru64)
+   # The Tru64 AIX compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+
+   tmpdepfile1="$object.d"
+   tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'` 
+   if test "$libtool" = yes; then
+      "$@" -Wc,-MD
+   else
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2"
+      exit $stat
+   fi
+
+   if test -f "$tmpdepfile1"; then
+      tmpdepfile="$tmpdepfile1"
+   else
+      tmpdepfile="$tmpdepfile2"
+   fi
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a space and a tab in the [].
+      sed -e 's,^.*\.[a-z]*:[ 	]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the proprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  test -z "$dashmflag" && dashmflag=-M
+  ( IFS=" "
+    case " $* " in
+    *" --mode=compile "*) # this is libtool, let us make it quiet
+      for arg
+      do # cycle over the arguments
+        case "$arg" in
+	"--mode=compile")
+	  # insert --quiet before "--mode=compile"
+	  set fnord "$@" --quiet
+	  shift # fnord
+	  ;;
+	esac
+	set fnord "$@" "$arg"
+	shift # fnord
+	shift # "$arg"
+      done
+      ;;
+    esac
+    "$@" $dashmflag | sed 's:^[^:]*\:[ 	]*:'"$object"'\: :' > "$tmpdepfile"
+  ) &
+  proc=$!
+  "$@"
+  stat=$?
+  wait "$proc"
+  if test "$stat" != 0; then exit $stat; fi
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  # X makedepend
+  (
+    shift
+    cleared=no
+    for arg in "$@"; do
+      case $cleared in no)
+        set ""; shift
+	cleared=yes
+      esac
+      case "$arg" in
+        -D*|-I*)
+	  set fnord "$@" "$arg"; shift;;
+	-*)
+	  ;;
+	*)
+	  set fnord "$@" "$arg"; shift;;
+      esac
+    done
+    obj_suffix="`echo $object | sed 's/^.*\././'`"
+    touch "$tmpdepfile"
+    ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  ) &
+  proc=$!
+  "$@"
+  stat=$?
+  wait "$proc"
+  if test "$stat" != 0; then exit $stat; fi
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tail +3 "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the proprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  ( IFS=" "
+    case " $* " in
+    *" --mode=compile "*)
+      for arg
+      do # cycle over the arguments
+        case $arg in
+	"--mode=compile")
+	  # insert --quiet before "--mode=compile"
+	  set fnord "$@" --quiet
+	  shift # fnord
+	  ;;
+	esac
+	set fnord "$@" "$arg"
+	shift # fnord
+	shift # "$arg"
+      done
+      ;;
+    esac
+    "$@" -E |
+    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  ) &
+  proc=$!
+  "$@"
+  stat=$?
+  wait "$proc"
+  if test "$stat" != 0; then exit $stat; fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the proprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  ( IFS=" "
+    case " $* " in
+    *" --mode=compile "*)
+      for arg
+      do # cycle over the arguments
+        case $arg in
+	"--mode=compile")
+	  # insert --quiet before "--mode=compile"
+	  set fnord "$@" --quiet
+	  shift # fnord
+	  ;;
+	esac
+	set fnord "$@" "$arg"
+	shift # fnord
+	shift # "$arg"
+      done
+      ;;
+    esac
+    "$@" -E |
+    sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  ) &
+  proc=$!
+  "$@"
+  stat=$?
+  wait "$proc"
+  if test "$stat" != 0; then exit $stat; fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  echo "	" >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
--- metamail-2.7.orig/config/ltmain.sh
+++ metamail-2.7/config/ltmain.sh
@@ -0,0 +1,5107 @@
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun configure.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Check that we have a working $echo.
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell, and then maybe $echo will work.
+  exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit 0
+fi
+
+# The name of this program.
+progname=`$echo "$0" | ${SED} 's%^.*/%%'`
+modename="$progname"
+
+# Constants.
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.4.3
+TIMESTAMP=" (1.922.2.111 2002/10/23 02:54:36)"
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+# test EBCDIC or ASCII                                                         
+case `echo A|od -x` in                                                         
+ *[Cc]1*) # EBCDIC based system                                                
+  SP2NL="tr '\100' '\n'"                                                       
+  NL2SP="tr '\r\n' '\100\100'"                                                 
+  ;;                                                                           
+ *) # Assume ASCII based system                                                
+  SP2NL="tr '\040' '\012'"                                                     
+  NL2SP="tr '\015\012' '\040\040'"                                             
+  ;;                                                                           
+esac                                                                           
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+if test "${LC_ALL+set}" = set; then
+  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
+fi
+if test "${LANG+set}" = set; then
+  save_LANG="$LANG"; LANG=C; export LANG
+fi
+
+# Make sure IFS has a sensible default
+: ${IFS=" 	"}
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+  echo "$modename: not configured to build any kind of library" 1>&2
+  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+  exit 1
+fi
+
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+
+# Parse our command line options once, thoroughly.
+while test $# -gt 0
+do
+  arg="$1"
+  shift
+
+  case $arg in
+  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) optarg= ;;
+  esac
+
+  # If the previous option needs an argument, assign it.
+  if test -n "$prev"; then
+    case $prev in
+    execute_dlfiles)
+      execute_dlfiles="$execute_dlfiles $arg"
+      ;;
+    *)
+      eval "$prev=\$arg"
+      ;;
+    esac
+
+    prev=
+    prevopt=
+    continue
+  fi
+
+  # Have we seen a non-optional argument yet?
+  case $arg in
+  --help)
+    show_help=yes
+    ;;
+
+  --version)
+    echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
+    exit 0
+    ;;
+
+  --config)
+    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
+    exit 0
+    ;;
+
+  --debug)
+    echo "$progname: enabling shell trace mode"
+    set -x
+    ;;
+
+  --dry-run | -n)
+    run=:
+    ;;
+
+  --features)
+    echo "host: $host"
+    if test "$build_libtool_libs" = yes; then
+      echo "enable shared libraries"
+    else
+      echo "disable shared libraries"
+    fi
+    if test "$build_old_libs" = yes; then
+      echo "enable static libraries"
+    else
+      echo "disable static libraries"
+    fi
+    exit 0
+    ;;
+
+  --finish) mode="finish" ;;
+
+  --mode) prevopt="--mode" prev=mode ;;
+  --mode=*) mode="$optarg" ;;
+
+  --preserve-dup-deps) duplicate_deps="yes" ;;
+
+  --quiet | --silent)
+    show=:
+    ;;
+
+  -dlopen)
+    prevopt="-dlopen"
+    prev=execute_dlfiles
+    ;;
+
+  -*)
+    $echo "$modename: unrecognized option \`$arg'" 1>&2
+    $echo "$help" 1>&2
+    exit 1
+    ;;
+
+  *)
+    nonopt="$arg"
+    break
+    ;;
+  esac
+done
+
+if test -n "$prevopt"; then
+  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+  $echo "$help" 1>&2
+  exit 1
+fi
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end.  This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+if test -z "$show_help"; then
+
+  # Infer the operation mode.
+  if test -z "$mode"; then
+    case $nonopt in
+    *cc | *++ | gcc* | *-gcc* | g++* | xlc*)
+      mode=link
+      for arg
+      do
+	case $arg in
+	-c)
+	   mode=compile
+	   break
+	   ;;
+	esac
+      done
+      ;;
+    *db | *dbx | *strace | *truss)
+      mode=execute
+      ;;
+    *install*|cp|mv)
+      mode=install
+      ;;
+    *rm)
+      mode=uninstall
+      ;;
+    *)
+      # If we have no mode, but dlfiles were specified, then do execute mode.
+      test -n "$execute_dlfiles" && mode=execute
+
+      # Just use the default operation mode.
+      if test -z "$mode"; then
+	if test -n "$nonopt"; then
+	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+	else
+	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+	fi
+      fi
+      ;;
+    esac
+  fi
+
+  # Only execute mode is allowed to have -dlopen flags.
+  if test -n "$execute_dlfiles" && test "$mode" != execute; then
+    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+    $echo "$help" 1>&2
+    exit 1
+  fi
+
+  # Change the help message to a mode-specific one.
+  generic_help="$help"
+  help="Try \`$modename --help --mode=$mode' for more information."
+
+  # These modes are in order of execution frequency so that they run quickly.
+  case $mode in
+  # libtool compile mode
+  compile)
+    modename="$modename: compile"
+    # Get the compilation command and the source file.
+    base_compile=
+    prev=
+    lastarg=
+    srcfile="$nonopt"
+    suppress_output=
+
+    user_target=no
+    for arg
+    do
+      case $prev in
+      "") ;;
+      xcompiler)
+	# Aesthetically quote the previous argument.
+	prev=
+	lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+
+	case $arg in
+	# Double-quote args containing other shell metacharacters.
+	# Many Bourne shells cannot handle close brackets correctly
+	# in scan sets, so we specify it separately.
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+
+	# Add the previous argument to base_compile.
+	if test -z "$base_compile"; then
+	  base_compile="$lastarg"
+	else
+	  base_compile="$base_compile $lastarg"
+	fi
+	continue
+	;;
+      esac
+
+      # Accept any command-line options.
+      case $arg in
+      -o)
+	if test "$user_target" != "no"; then
+	  $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+	  exit 1
+	fi
+	user_target=next
+	;;
+
+      -static)
+	build_old_libs=yes
+	continue
+	;;
+
+      -prefer-pic)
+	pic_mode=yes
+	continue
+	;;
+
+      -prefer-non-pic)
+	pic_mode=no
+	continue
+	;;
+
+      -Xcompiler)
+	prev=xcompiler
+	continue
+	;;
+
+      -Wc,*)
+	args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
+	lastarg=
+	save_ifs="$IFS"; IFS=','
+	for arg in $args; do
+	  IFS="$save_ifs"
+
+	  # Double-quote args containing other shell metacharacters.
+	  # Many Bourne shells cannot handle close brackets correctly
+	  # in scan sets, so we specify it separately.
+	  case $arg in
+	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	    arg="\"$arg\""
+	    ;;
+	  esac
+	  lastarg="$lastarg $arg"
+	done
+	IFS="$save_ifs"
+	lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
+
+	# Add the arguments to base_compile.
+	if test -z "$base_compile"; then
+	  base_compile="$lastarg"
+	else
+	  base_compile="$base_compile $lastarg"
+	fi
+	continue
+	;;
+      esac
+
+      case $user_target in
+      next)
+	# The next one is the -o target name
+	user_target=yes
+	continue
+	;;
+      yes)
+	# We got the output file
+	user_target=set
+	libobj="$arg"
+	continue
+	;;
+      esac
+
+      # Accept the current argument as the source file.
+      lastarg="$srcfile"
+      srcfile="$arg"
+
+      # Aesthetically quote the previous argument.
+
+      # Backslashify any backslashes, double quotes, and dollar signs.
+      # These are the only characters that are still specially
+      # interpreted inside of double-quoted scrings.
+      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+      # Double-quote args containing other shell metacharacters.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      case $lastarg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	lastarg="\"$lastarg\""
+	;;
+      esac
+
+      # Add the previous argument to base_compile.
+      if test -z "$base_compile"; then
+	base_compile="$lastarg"
+      else
+	base_compile="$base_compile $lastarg"
+      fi
+    done
+
+    case $user_target in
+    set)
+      ;;
+    no)
+      # Get the name of the library object.
+      libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+      ;;
+    *)
+      $echo "$modename: you must specify a target with \`-o'" 1>&2
+      exit 1
+      ;;
+    esac
+
+    # Recognize several different file suffixes.
+    # If the user specifies -o file.o, it is replaced with file.lo
+    xform='[cCFSfmso]'
+    case $libobj in
+    *.ada) xform=ada ;;
+    *.adb) xform=adb ;;
+    *.ads) xform=ads ;;
+    *.asm) xform=asm ;;
+    *.c++) xform=c++ ;;
+    *.cc) xform=cc ;;
+    *.cpp) xform=cpp ;;
+    *.cxx) xform=cxx ;;
+    *.f90) xform=f90 ;;
+    *.for) xform=for ;;
+    esac
+
+    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+    case $libobj in
+    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+    *)
+      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
+      exit 1
+      ;;
+    esac
+
+    if test -z "$base_compile"; then
+      $echo "$modename: you must specify a compilation command" 1>&2
+      $echo "$help" 1>&2
+      exit 1
+    fi
+
+    # Delete any leftover library objects.
+    if test "$build_old_libs" = yes; then
+      removelist="$obj $libobj"
+    else
+      removelist="$libobj"
+    fi
+
+    $run $rm $removelist
+    trap "$run $rm $removelist; exit 1" 1 2 15
+
+    # On Cygwin there's no "real" PIC flag so we must build both object types
+    case $host_os in
+    cygwin* | mingw* | pw32* | os2*)
+      pic_mode=default
+      ;;
+    esac
+    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+      # non-PIC code in shared libraries is not supported
+      pic_mode=default
+    fi
+
+    # Calculate the filename of the output object if compiler does
+    # not support -o with -c
+    if test "$compiler_c_o" = no; then
+      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+      lockfile="$output_obj.lock"
+      removelist="$removelist $output_obj $lockfile"
+      trap "$run $rm $removelist; exit 1" 1 2 15
+    else
+      need_locks=no
+      lockfile=
+    fi
+
+    # Lock this critical section if it is needed
+    # We use this script file to make the link, it avoids creating a new file
+    if test "$need_locks" = yes; then
+      until $run ln "$0" "$lockfile" 2>/dev/null; do
+	$show "Waiting for $lockfile to be removed"
+	sleep 2
+      done
+    elif test "$need_locks" = warn; then
+      if test -f "$lockfile"; then
+	echo "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$run $rm $removelist
+	exit 1
+      fi
+      echo $srcfile > "$lockfile"
+    fi
+
+    if test -n "$fix_srcfile_path"; then
+      eval srcfile=\"$fix_srcfile_path\"
+    fi
+
+    # Only build a PIC object if we are building libtool libraries.
+    if test "$build_libtool_libs" = yes; then
+      # Without this assignment, base_compile gets emptied.
+      fbsd_hideous_sh_bug=$base_compile
+
+      if test "$pic_mode" != no; then
+	# All platforms use -DPIC, to notify preprocessed assembler code.
+	command="$base_compile $srcfile $pic_flag -DPIC"
+      else
+	# Don't build PIC code
+	command="$base_compile $srcfile"
+      fi
+      if test "$build_old_libs" = yes; then
+	lo_libobj="$libobj"
+	dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
+	if test "X$dir" = "X$libobj"; then
+	  dir="$objdir"
+	else
+	  dir="$dir/$objdir"
+	fi
+	libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
+
+	if test -d "$dir"; then
+	  $show "$rm $libobj"
+	  $run $rm $libobj
+	else
+	  $show "$mkdir $dir"
+	  $run $mkdir $dir
+	  status=$?
+	  if test $status -ne 0 && test ! -d $dir; then
+	    exit $status
+	  fi
+	fi
+      fi
+      if test "$compiler_o_lo" = yes; then
+	output_obj="$libobj"
+	command="$command -o $output_obj"
+      elif test "$compiler_c_o" = yes; then
+	output_obj="$obj"
+	command="$command -o $output_obj"
+      fi
+
+      $run $rm "$output_obj"
+      $show "$command"
+      if $run eval "$command"; then :
+      else
+	test -n "$output_obj" && $run $rm $removelist
+	exit 1
+      fi
+
+      if test "$need_locks" = warn &&
+	 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
+	echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$run $rm $removelist
+	exit 1
+      fi
+
+      # Just move the object if needed, then go on to compile the next one
+      if test x"$output_obj" != x"$libobj"; then
+	$show "$mv $output_obj $libobj"
+	if $run $mv $output_obj $libobj; then :
+	else
+	  error=$?
+	  $run $rm $removelist
+	  exit $error
+	fi
+      fi
+
+      # If we have no pic_flag, then copy the object into place and finish.
+      if (test -z "$pic_flag" || test "$pic_mode" != default) &&
+	 test "$build_old_libs" = yes; then
+	# Rename the .lo from within objdir to obj
+	if test -f $obj; then
+	  $show $rm $obj
+	  $run $rm $obj
+	fi
+
+	$show "$mv $libobj $obj"
+	if $run $mv $libobj $obj; then :
+	else
+	  error=$?
+	  $run $rm $removelist
+	  exit $error
+	fi
+
+	xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+	if test "X$xdir" = "X$obj"; then
+	  xdir="."
+	else
+	  xdir="$xdir"
+	fi
+	baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
+	libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
+	# Now arrange that obj and lo_libobj become the same file
+	$show "(cd $xdir && $LN_S $baseobj $libobj)"
+	if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
+	  # Unlock the critical section if it was locked
+	  if test "$need_locks" != no; then
+	    $run $rm "$lockfile"
+	  fi
+	  exit 0
+	else
+	  error=$?
+	  $run $rm $removelist
+	  exit $error
+	fi
+      fi
+
+      # Allow error messages only from the first compilation.
+      suppress_output=' >/dev/null 2>&1'
+    fi
+
+    # Only build a position-dependent object if we build old libraries.
+    if test "$build_old_libs" = yes; then
+      if test "$pic_mode" != yes; then
+	# Don't build PIC code
+	command="$base_compile $srcfile"
+      else
+	# All platforms use -DPIC, to notify preprocessed assembler code.
+	command="$base_compile $srcfile $pic_flag -DPIC"
+      fi
+      if test "$compiler_c_o" = yes; then
+	command="$command -o $obj"
+	output_obj="$obj"
+      fi
+
+      # Suppress compiler output if we already did a PIC compilation.
+      command="$command$suppress_output"
+      $run $rm "$output_obj"
+      $show "$command"
+      if $run eval "$command"; then :
+      else
+	$run $rm $removelist
+	exit 1
+      fi
+
+      if test "$need_locks" = warn &&
+	 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
+	echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$run $rm $removelist
+	exit 1
+      fi
+
+      # Just move the object if needed
+      if test x"$output_obj" != x"$obj"; then
+	$show "$mv $output_obj $obj"
+	if $run $mv $output_obj $obj; then :
+	else
+	  error=$?
+	  $run $rm $removelist
+	  exit $error
+	fi
+      fi
+
+      # Create an invalid libtool object if no PIC, so that we do not
+      # accidentally link it into a program.
+      if test "$build_libtool_libs" != yes; then
+	$show "echo timestamp > $libobj"
+	$run eval "echo timestamp > \$libobj" || exit $?
+      else
+	# Move the .lo from within objdir
+	$show "$mv $libobj $lo_libobj"
+	if $run $mv $libobj $lo_libobj; then :
+	else
+	  error=$?
+	  $run $rm $removelist
+	  exit $error
+	fi
+      fi
+    fi
+
+    # Unlock the critical section if it was locked
+    if test "$need_locks" != no; then
+      $run $rm "$lockfile"
+    fi
+
+    exit 0
+    ;;
+
+  # libtool link mode
+  link | relink)
+    modename="$modename: link"
+    case $host in
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+      # It is impossible to link a dll without this setting, and
+      # we shouldn't force the makefile maintainer to figure out
+      # which system we are compiling for in order to pass an extra
+      # flag for every libtool invokation.
+      # allow_undefined=no
+
+      # FIXME: Unfortunately, there are problems with the above when trying
+      # to make a dll which has undefined symbols, in which case not
+      # even a static library is built.  For now, we need to specify
+      # -no-undefined on the libtool link line when we can be certain
+      # that all symbols are satisfied, otherwise we get a static library.
+      allow_undefined=yes
+      ;;
+    *)
+      allow_undefined=yes
+      ;;
+    esac
+    libtool_args="$nonopt"
+    compile_command="$nonopt"
+    finalize_command="$nonopt"
+
+    compile_rpath=
+    finalize_rpath=
+    compile_shlibpath=
+    finalize_shlibpath=
+    convenience=
+    old_convenience=
+    deplibs=
+    old_deplibs=
+    compiler_flags=
+    linker_flags=
+    dllsearchpath=
+    lib_search_path=`pwd`
+    inst_prefix_dir=
+
+    avoid_version=no
+    dlfiles=
+    dlprefiles=
+    dlself=no
+    export_dynamic=no
+    export_symbols=
+    export_symbols_regex=
+    generated=
+    libobjs=
+    ltlibs=
+    module=no
+    no_install=no
+    objs=
+    prefer_static_libs=no
+    preload=no
+    prev=
+    prevarg=
+    release=
+    rpath=
+    xrpath=
+    perm_rpath=
+    temp_rpath=
+    thread_safe=no
+    vinfo=
+
+    # We need to know -static, to get the right output filenames.
+    for arg
+    do
+      case $arg in
+      -all-static | -static)
+	if test "X$arg" = "X-all-static"; then
+	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+	  fi
+	  if test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	else
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	fi
+	build_libtool_libs=no
+	build_old_libs=yes
+	prefer_static_libs=yes
+	break
+	;;
+      esac
+    done
+
+    # See if our shared archives depend on static archives.
+    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+    # Go through the arguments, transforming them on the way.
+    while test $# -gt 0; do
+      arg="$1"
+      shift
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
+	;;
+      *) qarg=$arg ;;
+      esac
+      libtool_args="$libtool_args $qarg"
+
+      # If the previous option needs an argument, assign it.
+      if test -n "$prev"; then
+	case $prev in
+	output)
+	  compile_command="$compile_command @OUTPUT@"
+	  finalize_command="$finalize_command @OUTPUT@"
+	  ;;
+	esac
+
+	case $prev in
+	dlfiles|dlprefiles)
+	  if test "$preload" = no; then
+	    # Add the symbol object into the linking commands.
+	    compile_command="$compile_command @SYMFILE@"
+	    finalize_command="$finalize_command @SYMFILE@"
+	    preload=yes
+	  fi
+	  case $arg in
+	  *.la | *.lo) ;;  # We handle these cases below.
+	  force)
+	    if test "$dlself" = no; then
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  self)
+	    if test "$prev" = dlprefiles; then
+	      dlself=yes
+	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+	      dlself=yes
+	    else
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  *)
+	    if test "$prev" = dlfiles; then
+	      dlfiles="$dlfiles $arg"
+	    else
+	      dlprefiles="$dlprefiles $arg"
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  esac
+	  ;;
+	expsyms)
+	  export_symbols="$arg"
+	  if test ! -f "$arg"; then
+	    $echo "$modename: symbol file \`$arg' does not exist"
+	    exit 1
+	  fi
+	  prev=
+	  continue
+	  ;;
+	expsyms_regex)
+	  export_symbols_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	inst_prefix)
+	  inst_prefix_dir="$arg"
+	  prev=
+	  continue
+	  ;;
+	release)
+	  release="-$arg"
+	  prev=
+	  continue
+	  ;;
+	rpath | xrpath)
+	  # We need an absolute path.
+	  case $arg in
+	  [\\/]* | [A-Za-z]:[\\/]*) ;;
+	  *)
+	    $echo "$modename: only absolute run-paths are allowed" 1>&2
+	    exit 1
+	    ;;
+	  esac
+	  if test "$prev" = rpath; then
+	    case "$rpath " in
+	    *" $arg "*) ;;
+	    *) rpath="$rpath $arg" ;;
+	    esac
+	  else
+	    case "$xrpath " in
+	    *" $arg "*) ;;
+	    *) xrpath="$xrpath $arg" ;;
+	    esac
+	  fi
+	  prev=
+	  continue
+	  ;;
+	xcompiler)
+	  compiler_flags="$compiler_flags $qarg"
+	  prev=
+	  compile_command="$compile_command $qarg"
+	  finalize_command="$finalize_command $qarg"
+	  continue
+	  ;;
+	xlinker)
+	  linker_flags="$linker_flags $qarg"
+	  compiler_flags="$compiler_flags $wl$qarg"
+	  prev=
+	  compile_command="$compile_command $wl$qarg"
+	  finalize_command="$finalize_command $wl$qarg"
+	  continue
+	  ;;
+	*)
+	  eval "$prev=\"\$arg\""
+	  prev=
+	  continue
+	  ;;
+	esac
+      fi # test -n $prev
+
+      prevarg="$arg"
+
+      case $arg in
+      -all-static)
+	if test -n "$link_static_flag"; then
+	  compile_command="$compile_command $link_static_flag"
+	  finalize_command="$finalize_command $link_static_flag"
+	fi
+	continue
+	;;
+
+      -allow-undefined)
+	# FIXME: remove this flag sometime in the future.
+	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+	continue
+	;;
+
+      -avoid-version)
+	avoid_version=yes
+	continue
+	;;
+
+      -dlopen)
+	prev=dlfiles
+	continue
+	;;
+
+      -dlpreopen)
+	prev=dlprefiles
+	continue
+	;;
+
+      -export-dynamic)
+	export_dynamic=yes
+	continue
+	;;
+
+      -export-symbols | -export-symbols-regex)
+	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+	  $echo "$modename: more than one -exported-symbols argument is not allowed"
+	  exit 1
+	fi
+	if test "X$arg" = "X-export-symbols"; then
+	  prev=expsyms
+	else
+	  prev=expsyms_regex
+	fi
+	continue
+	;;
+
+      -inst-prefix-dir)
+       prev=inst_prefix
+       continue
+       ;;
+
+      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+      # so, if we see these flags be careful not to treat them like -L
+      -L[A-Z][A-Z]*:*)
+	case $with_gcc/$host in
+	no/*-*-irix* | no/*-*-nonstopux*)
+	  compile_command="$compile_command $arg"
+	  finalize_command="$finalize_command $arg"
+	  ;;
+	esac
+	continue
+	;;
+
+      -L*)
+	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  absdir=`cd "$dir" && pwd`
+	  if test -z "$absdir"; then
+	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
+	    exit 1
+	  fi
+	  dir="$absdir"
+	  ;;
+	esac
+	case "$deplibs " in
+	*" -L$dir "*) ;;
+	*)
+	  deplibs="$deplibs -L$dir"
+	  lib_search_path="$lib_search_path $dir"
+	  ;;
+	esac
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  case :$dllsearchpath: in
+	  *":$dir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$dir";;
+	  esac
+	  ;;
+	esac
+	continue
+	;;
+
+      -l*)
+	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+	  case $host in
+	  *-*-cygwin* | *-*-pw32* | *-*-beos*)
+	    # These systems don't actually have a C or math library (as such)
+	    continue
+	    ;;
+	  *-*-mingw* | *-*-os2*)
+	    # These systems don't actually have a C library (as such)
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-openbsd* | *-*-freebsd*)
+	    # Do not include libc due to us having libc/libc_r.
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  esac
+	 elif test "X$arg" = "X-lc_r"; then
+	  case $host in
+	 *-*-openbsd* | *-*-freebsd*)
+	    # Do not include libc_r directly, use -pthread flag.
+	    continue
+	    ;;
+	  esac
+	fi
+	deplibs="$deplibs $arg"
+	continue
+	;;
+
+      -module)
+	module=yes
+	continue
+	;;
+
+      -no-fast-install)
+	fast_install=no
+	continue
+	;;
+
+      -no-install)
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  # The PATH hackery in wrapper scripts is required on Windows
+	  # in order for the loader to find any dlls it needs.
+	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
+	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
+	  fast_install=no
+	  ;;
+	*) no_install=yes ;;
+	esac
+	continue
+	;;
+
+      -no-undefined)
+	allow_undefined=no
+	continue
+	;;
+
+      -o) prev=output ;;
+
+      -release)
+	prev=release
+	continue
+	;;
+
+      -rpath)
+	prev=rpath
+	continue
+	;;
+
+      -R)
+	prev=xrpath
+	continue
+	;;
+
+      -R*)
+	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  $echo "$modename: only absolute run-paths are allowed" 1>&2
+	  exit 1
+	  ;;
+	esac
+	case "$xrpath " in
+	*" $dir "*) ;;
+	*) xrpath="$xrpath $dir" ;;
+	esac
+	continue
+	;;
+
+      -static)
+	# The effects of -static are defined in a previous loop.
+	# We used to do the same as -all-static on platforms that
+	# didn't have a PIC flag, but the assumption that the effects
+	# would be equivalent was wrong.  It would break on at least
+	# Digital Unix and AIX.
+	continue
+	;;
+
+      -thread-safe)
+	thread_safe=yes
+	continue
+	;;
+
+      -version-info)
+	prev=vinfo
+	continue
+	;;
+
+      -Wc,*)
+	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+	  case $flag in
+	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	    flag="\"$flag\""
+	    ;;
+	  esac
+	  arg="$arg $wl$flag"
+	  compiler_flags="$compiler_flags $flag"
+	done
+	IFS="$save_ifs"
+	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+	;;
+
+      -Wl,*)
+	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+	  case $flag in
+	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	    flag="\"$flag\""
+	    ;;
+	  esac
+	  arg="$arg $wl$flag"
+	  compiler_flags="$compiler_flags $wl$flag"
+	  linker_flags="$linker_flags $flag"
+	done
+	IFS="$save_ifs"
+	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+	;;
+
+      -Xcompiler)
+	prev=xcompiler
+	continue
+	;;
+
+      -Xlinker)
+	prev=xlinker
+	continue
+	;;
+
+      # Some other compiler flag.
+      -* | +*)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+	case $arg in
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+	;;
+
+      *.lo | *.$objext)
+	# A library or standard object.
+	if test "$prev" = dlfiles; then
+	  # This file was specified with -dlopen.
+	  if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+	    dlfiles="$dlfiles $arg"
+	    prev=
+	    continue
+	  else
+	    # If libtool objects are unsupported, then we need to preload.
+	    prev=dlprefiles
+	  fi
+	fi
+
+	if test "$prev" = dlprefiles; then
+	  # Preload the old-style object.
+	  dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
+	  prev=
+	else
+	  case $arg in
+	  *.lo) libobjs="$libobjs $arg" ;;
+	  *) objs="$objs $arg" ;;
+	  esac
+	fi
+	;;
+
+      *.$libext)
+	# An archive.
+	deplibs="$deplibs $arg"
+	old_deplibs="$old_deplibs $arg"
+	continue
+	;;
+
+      *.la)
+	# A libtool-controlled library.
+
+	if test "$prev" = dlfiles; then
+	  # This library was specified with -dlopen.
+	  dlfiles="$dlfiles $arg"
+	  prev=
+	elif test "$prev" = dlprefiles; then
+	  # The library was specified with -dlpreopen.
+	  dlprefiles="$dlprefiles $arg"
+	  prev=
+	else
+	  deplibs="$deplibs $arg"
+	fi
+	continue
+	;;
+
+      # Some other compiler argument.
+      *)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+	case $arg in
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+	;;
+      esac # arg
+
+      # Now actually substitute the argument into the commands.
+      if test -n "$arg"; then
+	compile_command="$compile_command $arg"
+	finalize_command="$finalize_command $arg"
+      fi
+    done # argument parsing loop
+
+    if test -n "$prev"; then
+      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+      $echo "$help" 1>&2
+      exit 1
+    fi
+
+    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+      eval arg=\"$export_dynamic_flag_spec\"
+      compile_command="$compile_command $arg"
+      finalize_command="$finalize_command $arg"
+    fi
+
+    # calculate the name of the file, without its directory
+    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+    libobjs_save="$libobjs"
+
+    if test -n "$shlibpath_var"; then
+      # get the directories listed in $shlibpath_var
+      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+    else
+      shlib_search_path=
+    fi
+    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+    if test "X$output_objdir" = "X$output"; then
+      output_objdir="$objdir"
+    else
+      output_objdir="$output_objdir/$objdir"
+    fi
+    # Create the object directory.
+    if test ! -d $output_objdir; then
+      $show "$mkdir $output_objdir"
+      $run $mkdir $output_objdir
+      status=$?
+      if test $status -ne 0 && test ! -d $output_objdir; then
+	exit $status
+      fi
+    fi
+
+    # Determine the type of output
+    case $output in
+    "")
+      $echo "$modename: you must specify an output file" 1>&2
+      $echo "$help" 1>&2
+      exit 1
+      ;;
+    *.$libext) linkmode=oldlib ;;
+    *.lo | *.$objext) linkmode=obj ;;
+    *.la) linkmode=lib ;;
+    *) linkmode=prog ;; # Anything else should be a program.
+    esac
+
+    specialdeplibs=
+    libs=
+    # Find all interdependent deplibs by searching for libraries
+    # that are linked more than once (e.g. -la -lb -la)
+    for deplib in $deplibs; do
+      if test "X$duplicate_deps" = "Xyes" ; then
+	case "$libs " in
+	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	esac
+      fi
+      libs="$libs $deplib"
+    done
+    deplibs=
+    newdependency_libs=
+    newlib_search_path=
+    need_relink=no # whether we're linking any uninstalled libtool libraries
+    notinst_deplibs= # not-installed libtool libraries
+    notinst_path= # paths that contain not-installed libtool libraries
+    case $linkmode in
+    lib)
+	passes="conv link"
+	for file in $dlfiles $dlprefiles; do
+	  case $file in
+	  *.la) ;;
+	  *)
+	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
+	    exit 1
+	    ;;
+	  esac
+	done
+	;;
+    prog)
+	compile_deplibs=
+	finalize_deplibs=
+	alldeplibs=no
+	newdlfiles=
+	newdlprefiles=
+	passes="conv scan dlopen dlpreopen link"
+	;;
+    *)  passes="conv"
+	;;
+    esac
+    for pass in $passes; do
+      if test $linkmode = prog; then
+	# Determine which files to process
+	case $pass in
+	dlopen)
+	  libs="$dlfiles"
+	  save_deplibs="$deplibs" # Collect dlpreopened libraries
+	  deplibs=
+	  ;;
+	dlpreopen) libs="$dlprefiles" ;;
+	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+	esac
+      fi
+      for deplib in $libs; do
+	lib=
+	found=no
+	case $deplib in
+	-l*)
+	  if test $linkmode = oldlib && test $linkmode = obj; then
+	    $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
+	    continue
+	  fi
+	  if test $pass = conv; then
+	    deplibs="$deplib $deplibs"
+	    continue
+	  fi
+	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
+	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
+	    # Search the libtool library
+	    lib="$searchdir/lib${name}.la"
+	    if test -f "$lib"; then
+	      found=yes
+	      break
+	    fi
+	  done
+	  if test "$found" != yes; then
+	    # deplib doesn't seem to be a libtool library
+	    if test "$linkmode,$pass" = "prog,link"; then
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      deplibs="$deplib $deplibs"
+	      test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    continue
+	  fi
+	  ;; # -l
+	-L*)
+	  case $linkmode in
+	  lib)
+	    deplibs="$deplib $deplibs"
+	    test $pass = conv && continue
+	    newdependency_libs="$deplib $newdependency_libs"
+	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+	    ;;
+	  prog)
+	    if test $pass = conv; then
+	      deplibs="$deplib $deplibs"
+	      continue
+	    fi
+	    if test $pass = scan; then
+	      deplibs="$deplib $deplibs"
+	      newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    ;;
+	  *)
+	    $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
+	    ;;
+	  esac # linkmode
+	  continue
+	  ;; # -L
+	-R*)
+	  if test $pass = link; then
+	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+	    # Make sure the xrpath contains only unique directories.
+	    case "$xrpath " in
+	    *" $dir "*) ;;
+	    *) xrpath="$xrpath $dir" ;;
+	    esac
+	  fi
+	  deplibs="$deplib $deplibs"
+	  continue
+	  ;;
+	*.la) lib="$deplib" ;;
+	*.$libext)
+	  if test $pass = conv; then
+	    deplibs="$deplib $deplibs"
+	    continue
+	  fi
+	  case $linkmode in
+	  lib)
+	    if test "$deplibs_check_method" != pass_all; then
+	      echo
+	      echo "*** Warning: Trying to link with static lib archive $deplib."
+	      echo "*** I have the capability to make that library automatically link in when"
+	      echo "*** you link to this library.  But I can only do this if you have a"
+	      echo "*** shared version of the library, which you do not appear to have"
+	      echo "*** because the file extensions .$libext of this argument makes me believe"
+	      echo "*** that it is just a static archive that I should not used here."
+	    else
+	      echo
+	      echo "*** Warning: Linking the shared library $output against the"
+	      echo "*** static library $deplib is not portable!"
+	      deplibs="$deplib $deplibs"
+	    fi
+	    continue
+	    ;;
+	  prog)
+	    if test $pass != link; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    continue
+	    ;;
+	  esac # linkmode
+	  ;; # *.$libext
+	*.lo | *.$objext)
+	  if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+	    # If there is no dlopen support or we're linking statically,
+	    # we need to preload.
+	    newdlprefiles="$newdlprefiles $deplib"
+	    compile_deplibs="$deplib $compile_deplibs"
+	    finalize_deplibs="$deplib $finalize_deplibs"
+	  else
+	    newdlfiles="$newdlfiles $deplib"
+	  fi
+	  continue
+	  ;;
+	%DEPLIBS%)
+	  alldeplibs=yes
+	  continue
+	  ;;
+	esac # case $deplib
+	if test $found = yes || test -f "$lib"; then :
+	else
+	  $echo "$modename: cannot find the library \`$lib'" 1>&2
+	  exit 1
+	fi
+
+	# Check to see that this really is a libtool archive.
+	if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+	else
+	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+	  exit 1
+	fi
+
+	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$ladir" = "X$lib" && ladir="."
+
+	dlname=
+	dlopen=
+	dlpreopen=
+	libdir=
+	library_names=
+	old_library=
+	# If the library was installed with an old release of libtool,
+	# it will not redefine variable installed.
+	installed=yes
+
+	# Read the .la file
+	case $lib in
+	*/* | *\\*) . $lib ;;
+	*) . ./$lib ;;
+	esac
+
+	if test "$linkmode,$pass" = "lib,link" ||
+	   test "$linkmode,$pass" = "prog,scan" ||
+	   { test $linkmode = oldlib && test $linkmode = obj; }; then
+	   # Add dl[pre]opened files of deplib
+	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+	fi
+
+	if test $pass = conv; then
+	  # Only check for convenience libraries
+	  deplibs="$lib $deplibs"
+	  if test -z "$libdir"; then
+	    if test -z "$old_library"; then
+	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+	      exit 1
+	    fi
+	    # It is a libtool convenience library, so add in its objects.
+	    convenience="$convenience $ladir/$objdir/$old_library"
+	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
+	    tmp_libs=
+	    for deplib in $dependency_libs; do
+	      deplibs="$deplib $deplibs"
+              if test "X$duplicate_deps" = "Xyes" ; then
+	        case "$tmp_libs " in
+	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	        esac
+              fi
+	      tmp_libs="$tmp_libs $deplib"
+	    done
+	  elif test $linkmode != prog && test $linkmode != lib; then
+	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
+	    exit 1
+	  fi
+	  continue
+	fi # $pass = conv
+
+	# Get the name of the library we link against.
+	linklib=
+	for l in $old_library $library_names; do
+	  linklib="$l"
+	done
+	if test -z "$linklib"; then
+	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+	  exit 1
+	fi
+
+	# This library was specified with -dlopen.
+	if test $pass = dlopen; then
+	  if test -z "$libdir"; then
+	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
+	    exit 1
+	  fi
+	  if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+	    # If there is no dlname, no dlopen support or we're linking
+	    # statically, we need to preload.
+	    dlprefiles="$dlprefiles $lib"
+	  else
+	    newdlfiles="$newdlfiles $lib"
+	  fi
+	  continue
+	fi # $pass = dlopen
+
+	# We need an absolute path.
+	case $ladir in
+	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+	*)
+	  abs_ladir=`cd "$ladir" && pwd`
+	  if test -z "$abs_ladir"; then
+	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
+	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+	    abs_ladir="$ladir"
+	  fi
+	  ;;
+	esac
+	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+
+	# Find the relevant object directory and library name.
+	if test "X$installed" = Xyes; then
+	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    libdir="$abs_ladir"
+	  else
+	    dir="$libdir"
+	    absdir="$libdir"
+	  fi
+	else
+	  dir="$ladir/$objdir"
+	  absdir="$abs_ladir/$objdir"
+	  # Remove this search path later
+	  notinst_path="$notinst_path $abs_ladir"
+	fi # $installed = yes
+	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+
+	# This library was specified with -dlpreopen.
+	if test $pass = dlpreopen; then
+	  if test -z "$libdir"; then
+	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
+	    exit 1
+	  fi
+	  # Prefer using a static library (so that no silly _DYNAMIC symbols
+	  # are required to link).
+	  if test -n "$old_library"; then
+	    newdlprefiles="$newdlprefiles $dir/$old_library"
+	  # Otherwise, use the dlname, so that lt_dlopen finds it.
+	  elif test -n "$dlname"; then
+	    newdlprefiles="$newdlprefiles $dir/$dlname"
+	  else
+	    newdlprefiles="$newdlprefiles $dir/$linklib"
+	  fi
+	fi # $pass = dlpreopen
+
+	if test -z "$libdir"; then
+	  # Link the convenience library
+	  if test $linkmode = lib; then
+	    deplibs="$dir/$old_library $deplibs"
+	  elif test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$dir/$old_library $compile_deplibs"
+	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
+	  else
+	    deplibs="$lib $deplibs"
+	  fi
+	  continue
+	fi
+
+	if test $linkmode = prog && test $pass != link; then
+	  newlib_search_path="$newlib_search_path $ladir"
+	  deplibs="$lib $deplibs"
+
+	  linkalldeplibs=no
+	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
+	     test "$build_libtool_libs" = no; then
+	    linkalldeplibs=yes
+	  fi
+
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    case $deplib in
+	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
+	    esac
+	    # Need to link against all dependency_libs?
+	    if test $linkalldeplibs = yes; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      # Need to hardcode shared library paths
+	      # or/and link against static libraries
+	      newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    if test "X$duplicate_deps" = "Xyes" ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      esac
+	    fi
+	    tmp_libs="$tmp_libs $deplib"
+	  done # for deplib
+	  continue
+	fi # $linkmode = prog...
+
+	link_static=no # Whether the deplib will be linked statically
+	if test -n "$library_names" &&
+	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+	  # Link against this shared library
+
+	  if test "$linkmode,$pass" = "prog,link" ||
+	   { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) compile_rpath="$compile_rpath $absdir"
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
+	      esac
+	      ;;
+	    esac
+	    if test $linkmode = prog; then
+	      # We need to hardcode the library path
+	      if test -n "$shlibpath_var"; then
+		# Make sure the rpath contains only unique directories.
+		case "$temp_rpath " in
+		*" $dir "*) ;;
+		*" $absdir "*) ;;
+		*) temp_rpath="$temp_rpath $dir" ;;
+		esac
+	      fi
+	    fi
+	  fi # $linkmode,$pass = prog,link...
+
+	  if test "$alldeplibs" = yes &&
+	     { test "$deplibs_check_method" = pass_all ||
+	       { test "$build_libtool_libs" = yes &&
+		 test -n "$library_names"; }; }; then
+	    # We only need to search for static libraries
+	    continue
+	  fi
+
+	  if test "$installed" = no; then
+	    notinst_deplibs="$notinst_deplibs $lib"
+	    need_relink=yes
+	  fi
+
+	  if test -n "$old_archive_from_expsyms_cmds"; then
+	    # figure out the soname
+	    set dummy $library_names
+	    realname="$2"
+	    shift; shift
+	    libname=`eval \\$echo \"$libname_spec\"`
+	    # use dlname if we got it. it's perfectly good, no?
+	    if test -n "$dlname"; then
+	      soname="$dlname"
+	    elif test -n "$soname_spec"; then
+	      # bleh windows
+	      case $host in
+	      *cygwin*)
+		major=`expr $current - $age`
+		versuffix="-$major"
+		;;
+	      esac
+	      eval soname=\"$soname_spec\"
+	    else
+	      soname="$realname"
+	    fi
+
+	    # Make a new name for the extract_expsyms_cmds to use
+	    soroot="$soname"
+	    soname=`echo $soroot | ${SED} -e 's/^.*\///'`
+	    newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
+
+	    # If the library has no export list, then create one now
+	    if test -f "$output_objdir/$soname-def"; then :
+	    else
+	      $show "extracting exported symbol list from \`$soname'"
+	      save_ifs="$IFS"; IFS='~'
+	      eval cmds=\"$extract_expsyms_cmds\"
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		$show "$cmd"
+		$run eval "$cmd" || exit $?
+	      done
+	      IFS="$save_ifs"
+	    fi
+
+	    # Create $newlib
+	    if test -f "$output_objdir/$newlib"; then :; else
+	      $show "generating import library for \`$soname'"
+	      save_ifs="$IFS"; IFS='~'
+	      eval cmds=\"$old_archive_from_expsyms_cmds\"
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		$show "$cmd"
+		$run eval "$cmd" || exit $?
+	      done
+	      IFS="$save_ifs"
+	    fi
+	    # make sure the library variables are pointing to the new library
+	    dir=$output_objdir
+	    linklib=$newlib
+	  fi # test -n $old_archive_from_expsyms_cmds
+
+	  if test $linkmode = prog || test "$mode" != relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    lib_linked=yes
+	    case $hardcode_action in
+	    immediate | unsupported)
+	      if test "$hardcode_direct" = no; then
+		add="$dir/$linklib"
+	      elif test "$hardcode_minus_L" = no; then
+		case $host in
+		*-*-sunos*) add_shlibpath="$dir" ;;
+		esac
+		add_dir="-L$dir"
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = no; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    relink)
+	      if test "$hardcode_direct" = yes; then
+		add="$dir/$linklib"
+	      elif test "$hardcode_minus_L" = yes; then
+		add_dir="-L$dir"
+		# Try looking first in the location we're being installed to.
+		if test -n "$inst_prefix_dir"; then
+		  case "$libdir" in
+		  [\/]*)
+		    add_dir="-L$inst_prefix_dir$libdir $add_dir"
+		    ;;
+		  esac
+		fi
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = yes; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    *) lib_linked=no ;;
+	    esac
+
+	    if test "$lib_linked" != yes; then
+	      $echo "$modename: configuration error: unsupported hardcode properties"
+	      exit 1
+	    fi
+
+	    if test -n "$add_shlibpath"; then
+	      case :$compile_shlibpath: in
+	      *":$add_shlibpath:"*) ;;
+	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+	      esac
+	    fi
+	    if test $linkmode = prog; then
+	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	      if test "$hardcode_direct" != yes && \
+		 test "$hardcode_minus_L" != yes && \
+		 test "$hardcode_shlibpath_var" = yes; then
+		case :$finalize_shlibpath: in
+		*":$libdir:"*) ;;
+		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+		esac
+	      fi
+	    fi
+	  fi
+
+	  if test $linkmode = prog || test "$mode" = relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    # Finalize command for both is simple: just hardcode it.
+	    if test "$hardcode_direct" = yes; then
+	      add="$libdir/$linklib"
+	    elif test "$hardcode_minus_L" = yes; then
+	      add_dir="-L$libdir"
+	      add="-l$name"
+	    elif test "$hardcode_shlibpath_var" = yes; then
+	      case :$finalize_shlibpath: in
+	      *":$libdir:"*) ;;
+	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+	      esac
+	      add="-l$name"
+	    else
+	      # We cannot seem to hardcode it, guess we'll fake it.
+	      add_dir="-L$libdir"
+	      # Try looking first in the location we're being installed to.
+	      if test -n "$inst_prefix_dir"; then
+		case "$libdir" in
+		[\/]*)
+		  add_dir="-L$inst_prefix_dir$libdir $add_dir"
+		  ;;
+		esac
+	      fi
+	      add="-l$name"
+	    fi
+
+	    if test $linkmode = prog; then
+	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	    fi
+	  fi
+	elif test $linkmode = prog; then
+	  if test "$alldeplibs" = yes &&
+	     { test "$deplibs_check_method" = pass_all ||
+	       { test "$build_libtool_libs" = yes &&
+		 test -n "$library_names"; }; }; then
+	    # We only need to search for static libraries
+	    continue
+	  fi
+
+	  # Try to link the static library
+	  # Here we assume that one of hardcode_direct or hardcode_minus_L
+	  # is not unsupported.  This is valid on all known static and
+	  # shared platforms.
+	  if test "$hardcode_direct" != unsupported; then
+	    test -n "$old_library" && linklib="$old_library"
+	    compile_deplibs="$dir/$linklib $compile_deplibs"
+	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
+	  else
+	    compile_deplibs="-l$name -L$dir $compile_deplibs"
+	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+	  fi
+	elif test "$build_libtool_libs" = yes; then
+	  # Not a shared library
+	  if test "$deplibs_check_method" != pass_all; then
+	    # We're trying link a shared library against a static one
+	    # but the system doesn't support it.
+
+	    # Just print a warning and add the library to dependency_libs so
+	    # that the program can be linked against the static library.
+	    echo
+	    echo "*** Warning: This system can not link to static lib archive $lib."
+	    echo "*** I have the capability to make that library automatically link in when"
+	    echo "*** you link to this library.  But I can only do this if you have a"
+	    echo "*** shared version of the library, which you do not appear to have."
+	    if test "$module" = yes; then
+	      echo "*** But as you try to build a module library, libtool will still create "
+	      echo "*** a static module, that should work as long as the dlopening application"
+	      echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+	      if test -z "$global_symbol_pipe"; then
+		echo
+		echo "*** However, this would only work if libtool was able to extract symbol"
+		echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+		echo "*** not find such a program.  So, this module is probably useless."
+		echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	      fi
+	      if test "$build_old_libs" = no; then
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  else
+	    convenience="$convenience $dir/$old_library"
+	    old_convenience="$old_convenience $dir/$old_library"
+	    deplibs="$dir/$old_library $deplibs"
+	    link_static=yes
+	  fi
+	fi # link shared/static library?
+
+	if test $linkmode = lib; then
+	  if test -n "$dependency_libs" &&
+	     { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
+	       test $link_static = yes; }; then
+	    # Extract -R from dependency_libs
+	    temp_deplibs=
+	    for libdir in $dependency_libs; do
+	      case $libdir in
+	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
+		   case " $xrpath " in
+		   *" $temp_xrpath "*) ;;
+		   *) xrpath="$xrpath $temp_xrpath";;
+		   esac;;
+	      *) temp_deplibs="$temp_deplibs $libdir";;
+	      esac
+	    done
+	    dependency_libs="$temp_deplibs"
+	  fi
+
+	  newlib_search_path="$newlib_search_path $absdir"
+	  # Link against this library
+	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+	  # ... and its dependency_libs
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    newdependency_libs="$deplib $newdependency_libs"
+	    if test "X$duplicate_deps" = "Xyes" ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      esac
+	    fi
+	    tmp_libs="$tmp_libs $deplib"
+	  done
+
+	  if test $link_all_deplibs != no; then
+	    # Add the search paths of all dependency libraries
+	    for deplib in $dependency_libs; do
+	      case $deplib in
+	      -L*) path="$deplib" ;;
+	      *.la)
+		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
+		test "X$dir" = "X$deplib" && dir="."
+		# We need an absolute path.
+		case $dir in
+		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+		*)
+		  absdir=`cd "$dir" && pwd`
+		  if test -z "$absdir"; then
+		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+		    absdir="$dir"
+		  fi
+		  ;;
+		esac
+		if grep "^installed=no" $deplib > /dev/null; then
+		  path="-L$absdir/$objdir"
+		else
+		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		  if test -z "$libdir"; then
+		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+		    exit 1
+		  fi
+		  if test "$absdir" != "$libdir"; then
+		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
+		  fi
+		  path="-L$absdir"
+		fi
+		;;
+	      *) continue ;;
+	      esac
+	      case " $deplibs " in
+	      *" $path "*) ;;
+	      *) deplibs="$deplibs $path" ;;
+	      esac
+	    done
+	  fi # link_all_deplibs != no
+	fi # linkmode = lib
+      done # for deplib in $libs
+      if test $pass = dlpreopen; then
+	# Link the dlpreopened libraries before other libraries
+	for deplib in $save_deplibs; do
+	  deplibs="$deplib $deplibs"
+	done
+      fi
+      if test $pass != dlopen; then
+	test $pass != scan && dependency_libs="$newdependency_libs"
+	if test $pass != conv; then
+	  # Make sure lib_search_path contains only unique directories.
+	  lib_search_path=
+	  for dir in $newlib_search_path; do
+	    case "$lib_search_path " in
+	    *" $dir "*) ;;
+	    *) lib_search_path="$lib_search_path $dir" ;;
+	    esac
+	  done
+	  newlib_search_path=
+	fi
+
+	if test "$linkmode,$pass" != "prog,link"; then
+	  vars="deplibs"
+	else
+	  vars="compile_deplibs finalize_deplibs"
+	fi
+	for var in $vars dependency_libs; do
+	  # Add libraries to $var in reverse order
+	  eval tmp_libs=\"\$$var\"
+	  new_libs=
+	  for deplib in $tmp_libs; do
+	    case $deplib in
+	    -L*) new_libs="$deplib $new_libs" ;;
+	    *)
+	      case " $specialdeplibs " in
+	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
+	      *)
+		case " $new_libs " in
+		*" $deplib "*) ;;
+		*) new_libs="$deplib $new_libs" ;;
+		esac
+		;;
+	      esac
+	      ;;
+	    esac
+	  done
+	  tmp_libs=
+	  for deplib in $new_libs; do
+	    case $deplib in
+	    -L*)
+	      case " $tmp_libs " in
+	      *" $deplib "*) ;;
+	      *) tmp_libs="$tmp_libs $deplib" ;;
+	      esac
+	      ;;
+	    *) tmp_libs="$tmp_libs $deplib" ;;
+	    esac
+	  done
+	  eval $var=\"$tmp_libs\"
+	done # for var
+      fi
+      if test "$pass" = "conv" &&
+       { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
+	libs="$deplibs" # reset libs
+	deplibs=
+      fi
+    done # for pass
+    if test $linkmode = prog; then
+      dlfiles="$newdlfiles"
+      dlprefiles="$newdlprefiles"
+    fi
+
+    case $linkmode in
+    oldlib)
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$rpath"; then
+	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$xrpath"; then
+	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$vinfo"; then
+	$echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$release"; then
+	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
+      fi
+
+      # Now set the variables for building old libraries.
+      build_libtool_libs=no
+      oldlibs="$output"
+      objs="$objs$old_deplibs"
+      ;;
+
+    lib)
+      # Make sure we only generate libraries of the form `libNAME.la'.
+      case $outputname in
+      lib*)
+	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+	eval libname=\"$libname_spec\"
+	;;
+      *)
+	if test "$module" = no; then
+	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
+	  $echo "$help" 1>&2
+	  exit 1
+	fi
+	if test "$need_lib_prefix" != no; then
+	  # Add the "lib" prefix for modules if required
+	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+	  eval libname=\"$libname_spec\"
+	else
+	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+	fi
+	;;
+      esac
+
+      if test -n "$objs"; then
+	if test "$deplibs_check_method" != pass_all; then
+	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
+	  exit 1
+	else
+	  echo
+	  echo "*** Warning: Linking the shared library $output against the non-libtool"
+	  echo "*** objects $objs is not portable!"
+	  libobjs="$libobjs $objs"
+	fi
+      fi
+
+      if test "$dlself" != no; then
+	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
+      fi
+
+      set dummy $rpath
+      if test $# -gt 2; then
+	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+      fi
+      install_libdir="$2"
+
+      oldlibs=
+      if test -z "$rpath"; then
+	if test "$build_libtool_libs" = yes; then
+	  # Building a libtool convenience library.
+	  libext=al
+	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
+	  build_libtool_libs=convenience
+	  build_old_libs=yes
+	fi
+
+	if test -n "$vinfo"; then
+	  $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
+	fi
+
+	if test -n "$release"; then
+	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
+	fi
+      else
+
+	# Parse the version information argument.
+	save_ifs="$IFS"; IFS=':'
+	set dummy $vinfo 0 0 0
+	IFS="$save_ifs"
+
+	if test -n "$8"; then
+	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
+	  $echo "$help" 1>&2
+	  exit 1
+	fi
+
+	current="$2"
+	revision="$3"
+	age="$4"
+
+	# Check that each of the things are valid numbers.
+	case $current in
+	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+	*)
+	  $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit 1
+	  ;;
+	esac
+
+	case $revision in
+	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+	*)
+	  $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit 1
+	  ;;
+	esac
+
+	case $age in
+	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+	*)
+	  $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit 1
+	  ;;
+	esac
+
+	if test $age -gt $current; then
+	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit 1
+	fi
+
+	# Calculate the version variables.
+	major=
+	versuffix=
+	verstring=
+	case $version_type in
+	none) ;;
+
+	darwin)
+	  # Like Linux, but with the current version available in
+	  # verstring for coding it into the library header
+	  major=.`expr $current - $age`
+	  versuffix="$major.$age.$revision"
+	  # Darwin ld doesn't like 0 for these options...
+	  minor_current=`expr $current + 1`
+	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+	  ;;
+
+	freebsd-aout)
+	  major=".$current"
+	  versuffix=".$current.$revision";
+	  ;;
+
+	freebsd-elf)
+	  major=".$current"
+	  versuffix=".$current";
+	  ;;
+
+	irix | nonstopux)
+	  major=`expr $current - $age + 1`
+
+	  case $version_type in
+	    nonstopux) verstring_prefix=nonstopux ;;
+	    *)         verstring_prefix=sgi ;;
+	  esac
+	  verstring="$verstring_prefix$major.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$revision
+	  while test $loop != 0; do
+	    iface=`expr $revision - $loop`
+	    loop=`expr $loop - 1`
+	    verstring="$verstring_prefix$major.$iface:$verstring"
+	  done
+
+	  # Before this point, $major must not contain `.'.
+	  major=.$major
+	  versuffix="$major.$revision"
+	  ;;
+
+	linux)
+	  major=.`expr $current - $age`
+	  versuffix="$major.$age.$revision"
+	  ;;
+
+	osf)
+	  major=.`expr $current - $age`
+	  versuffix=".$current.$age.$revision"
+	  verstring="$current.$age.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$age
+	  while test $loop != 0; do
+	    iface=`expr $current - $loop`
+	    loop=`expr $loop - 1`
+	    verstring="$verstring:${iface}.0"
+	  done
+
+	  # Make executables depend on our current version.
+	  verstring="$verstring:${current}.0"
+	  ;;
+
+	sunos)
+	  major=".$current"
+	  versuffix=".$current.$revision"
+	  ;;
+
+	windows)
+	  # Use '-' rather than '.', since we only want one
+	  # extension on DOS 8.3 filesystems.
+	  major=`expr $current - $age`
+	  versuffix="-$major"
+	  ;;
+
+	*)
+	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
+	  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+	  exit 1
+	  ;;
+	esac
+
+	# Clear the version info if we defaulted, and they specified a release.
+	if test -z "$vinfo" && test -n "$release"; then
+	  major=
+	  verstring="0.0"
+	  case $version_type in
+	  darwin)
+	    # we can't check for "0.0" in archive_cmds due to quoting
+	    # problems, so we reset it completely
+	    verstring=""
+	    ;;
+	  *)
+	    verstring="0.0"
+	    ;;
+	  esac
+	  if test "$need_version" = no; then
+	    versuffix=
+	  else
+	    versuffix=".0.0"
+	  fi
+	fi
+
+	# Remove version info from name if versioning should be avoided
+	if test "$avoid_version" = yes && test "$need_version" = no; then
+	  major=
+	  versuffix=
+	  verstring=""
+	fi
+
+	# Check to see if the archive will have undefined symbols.
+	if test "$allow_undefined" = yes; then
+	  if test "$allow_undefined_flag" = unsupported; then
+	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
+	    build_libtool_libs=no
+	    build_old_libs=yes
+	  fi
+	else
+	  # Don't allow undefined symbols.
+	  allow_undefined_flag="$no_undefined_flag"
+	fi
+      fi
+
+      if test "$mode" != relink; then
+	# Remove our outputs.
+	$show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
+	$run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
+      fi
+
+      # Now set the variables for building old libraries.
+      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+	oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+	# Transform .lo files to .o files.
+	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+      fi
+
+      # Eliminate all temporary directories.
+      for path in $notinst_path; do
+	lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
+	deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
+	dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
+      done
+
+      if test -n "$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	temp_xrpath=
+	for libdir in $xrpath; do
+	  temp_xrpath="$temp_xrpath -R$libdir"
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  esac
+	done
+	if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
+	  dependency_libs="$temp_xrpath $dependency_libs"
+	fi
+      fi
+
+      # Make sure dlfiles contains only unique files that won't be dlpreopened
+      old_dlfiles="$dlfiles"
+      dlfiles=
+      for lib in $old_dlfiles; do
+	case " $dlprefiles $dlfiles " in
+	*" $lib "*) ;;
+	*) dlfiles="$dlfiles $lib" ;;
+	esac
+      done
+
+      # Make sure dlprefiles contains only unique files
+      old_dlprefiles="$dlprefiles"
+      dlprefiles=
+      for lib in $old_dlprefiles; do
+	case "$dlprefiles " in
+	*" $lib "*) ;;
+	*) dlprefiles="$dlprefiles $lib" ;;
+	esac
+      done
+
+      if test "$build_libtool_libs" = yes; then
+	if test -n "$rpath"; then
+	  case $host in
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
+	    # these systems don't actually have a c library (as such)!
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C library is in the System framework
+	    deplibs="$deplibs -framework System"
+	    ;;
+	  *-*-netbsd*)
+	    # Don't link with libc until the a.out ld.so is fixed.
+	    ;;
+	  *-*-openbsd* | *-*-freebsd*)
+	    # Do not include libc due to us having libc/libc_r.
+	    ;;
+	  *)
+	    # Add libc to deplibs on all other systems if necessary.
+	    if test $build_libtool_need_lc = "yes"; then
+	      deplibs="$deplibs -lc"
+	    fi
+	    ;;
+	  esac
+	fi
+
+	# Transform deplibs into only deplibs that can be linked in shared.
+	name_save=$name
+	libname_save=$libname
+	release_save=$release
+	versuffix_save=$versuffix
+	major_save=$major
+	# I'm not sure if I'm treating the release correctly.  I think
+	# release should show up in the -l (ie -lgmp5) so we don't want to
+	# add it in twice.  Is that correct?
+	release=""
+	versuffix=""
+	major=""
+	newdeplibs=
+	droppeddeps=no
+	case $deplibs_check_method in
+	pass_all)
+	  # Don't check for shared/static.  Everything works.
+	  # This might be a little naive.  We might want to check
+	  # whether the library exists or not.  But this is on
+	  # osf3 & osf4 and I'm not really sure... Just
+	  # implementing what was already the behaviour.
+	  newdeplibs=$deplibs
+	  ;;
+	test_compile)
+	  # This code stresses the "libraries are programs" paradigm to its
+	  # limits. Maybe even breaks it.  We compile a program, linking it
+	  # against the deplibs as a proxy for the library.  Then we can check
+	  # whether they linked in statically or dynamically with ldd.
+	  $rm conftest.c
+	  cat > conftest.c <<EOF
+	  int main() { return 0; }
+EOF
+	  $rm conftest
+	  $CC -o conftest conftest.c $deplibs
+	  if test $? -eq 0 ; then
+	    ldd_output=`ldd conftest`
+	    for i in $deplibs; do
+	      name="`expr $i : '-l\(.*\)'`"
+	      # If $name is empty we are operating on a -L argument.
+	      if test -n "$name" && test "$name" != "0"; then
+		libname=`eval \\$echo \"$libname_spec\"`
+		deplib_matches=`eval \\$echo \"$library_names_spec\"`
+		set dummy $deplib_matches
+		deplib_match=$2
+		if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		  newdeplibs="$newdeplibs $i"
+		else
+		  droppeddeps=yes
+		  echo
+		  echo "*** Warning: dynamic linker does not accept needed library $i."
+		  echo "*** I have the capability to make that library automatically link in when"
+		  echo "*** you link to this library.  But I can only do this if you have a"
+		  echo "*** shared version of the library, which I believe you do not have"
+		  echo "*** because a test_compile did reveal that the linker did not use it for"
+		  echo "*** its dynamic dependency list that programs get resolved with at runtime."
+		fi
+	      else
+		newdeplibs="$newdeplibs $i"
+	      fi
+	    done
+	  else
+	    # Error occured in the first compile.  Let's try to salvage
+	    # the situation: Compile a separate program for each library.
+	    for i in $deplibs; do
+	      name="`expr $i : '-l\(.*\)'`"
+	     # If $name is empty we are operating on a -L argument.
+	      if test -n "$name" && test "$name" != "0"; then
+		$rm conftest
+		$CC -o conftest conftest.c $i
+		# Did it work?
+		if test $? -eq 0 ; then
+		  ldd_output=`ldd conftest`
+		  libname=`eval \\$echo \"$libname_spec\"`
+		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
+		  set dummy $deplib_matches
+		  deplib_match=$2
+		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		    newdeplibs="$newdeplibs $i"
+		  else
+		    droppeddeps=yes
+		    echo
+		    echo "*** Warning: dynamic linker does not accept needed library $i."
+		    echo "*** I have the capability to make that library automatically link in when"
+		    echo "*** you link to this library.  But I can only do this if you have a"
+		    echo "*** shared version of the library, which you do not appear to have"
+		    echo "*** because a test_compile did reveal that the linker did not use this one"
+		    echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+		  fi
+		else
+		  droppeddeps=yes
+		  echo
+		  echo "*** Warning!  Library $i is needed by this library but I was not able to"
+		  echo "***  make it link in!  You will probably need to install it or some"
+		  echo "*** library that it depends on before this library will be fully"
+		  echo "*** functional.  Installing it before continuing would be even better."
+		fi
+	      else
+		newdeplibs="$newdeplibs $i"
+	      fi
+	    done
+	  fi
+	  ;;
+	file_magic*)
+	  set dummy $deplibs_check_method
+	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    name="`expr $a_deplib : '-l\(.*\)'`"
+	    # If $name is empty we are operating on a -L argument.
+	    if test -n "$name" && test "$name" != "0"; then
+	      libname=`eval \\$echo \"$libname_spec\"`
+	      for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		    for potent_lib in $potential_libs; do
+		      # Follow soft links.
+		      if ls -lLd "$potent_lib" 2>/dev/null \
+			 | grep " -> " >/dev/null; then
+			continue
+		      fi
+		      # The statement above tries to avoid entering an
+		      # endless loop below, in case of cyclic links.
+		      # We might still enter an endless loop, since a link
+		      # loop can be closed while we follow links,
+		      # but so what?
+		      potlib="$potent_lib"
+		      while test -h "$potlib" 2>/dev/null; do
+			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+			case $potliblink in
+			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+			esac
+		      done
+		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
+			 | ${SED} 10q \
+			 | egrep "$file_magic_regex" > /dev/null; then
+			newdeplibs="$newdeplibs $a_deplib"
+			a_deplib=""
+			break 2
+		      fi
+		    done
+	      done
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		echo
+		echo "*** Warning: linker path does not have real file for library $a_deplib."
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  echo "*** with $libname but no candidates were found. (...for file magic test)"
+		else
+		  echo "*** with $libname and none of the candidates passed a file format test"
+		  echo "*** using a file magic. Last file checked: $potlib"
+		fi
+	      fi
+	    else
+	      # Add a -L argument.
+	      newdeplibs="$newdeplibs $a_deplib"
+	    fi
+	  done # Gone through all deplibs.
+	  ;;
+	match_pattern*)
+	  set dummy $deplibs_check_method
+	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    name="`expr $a_deplib : '-l\(.*\)'`"
+	    # If $name is empty we are operating on a -L argument.
+	    if test -n "$name" && test "$name" != "0"; then
+	      libname=`eval \\$echo \"$libname_spec\"`
+	      for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		for potent_lib in $potential_libs; do
+		  potlib="$potent_lib" # see symlink-check below in file_magic test
+		  if eval echo \"$potent_lib\" 2>/dev/null \
+		      | ${SED} 10q \
+		      | egrep "$match_pattern_regex" > /dev/null; then
+		    newdeplibs="$newdeplibs $a_deplib"
+		    a_deplib=""
+		    break 2
+		  fi
+		done
+	      done
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		echo
+		echo "*** Warning: linker path does not have real file for library $a_deplib."
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  echo "*** with $libname but no candidates were found. (...for regex pattern test)"
+		else
+		  echo "*** with $libname and none of the candidates passed a file format test"
+		  echo "*** using a regex pattern. Last file checked: $potlib"
+		fi
+	      fi
+	    else
+	      # Add a -L argument.
+	      newdeplibs="$newdeplibs $a_deplib"
+	    fi
+	  done # Gone through all deplibs.
+	  ;;
+	none | unknown | *)
+	  newdeplibs=""
+	  if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+	       -e 's/ -[LR][^ ]*//g' -e 's/[ 	]//g' |
+	     grep . >/dev/null; then
+	    echo
+	    if test "X$deplibs_check_method" = "Xnone"; then
+	      echo "*** Warning: inter-library dependencies are not supported in this platform."
+	    else
+	      echo "*** Warning: inter-library dependencies are not known to be supported."
+	    fi
+	    echo "*** All declared inter-library dependencies are being dropped."
+	    droppeddeps=yes
+	  fi
+	  ;;
+	esac
+	versuffix=$versuffix_save
+	major=$major_save
+	release=$release_save
+	libname=$libname_save
+	name=$name_save
+
+	case $host in
+	*-*-rhapsody* | *-*-darwin1.[012])
+	  # On Rhapsody replace the C library is the System framework
+	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
+	  ;;
+	esac
+
+	if test "$droppeddeps" = yes; then
+	  if test "$module" = yes; then
+	    echo
+	    echo "*** Warning: libtool could not satisfy all declared inter-library"
+	    echo "*** dependencies of module $libname.  Therefore, libtool will create"
+	    echo "*** a static module, that should work as long as the dlopening"
+	    echo "*** application is linked with the -dlopen flag."
+	    if test -z "$global_symbol_pipe"; then
+	      echo
+	      echo "*** However, this would only work if libtool was able to extract symbol"
+	      echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+	      echo "*** not find such a program.  So, this module is probably useless."
+	      echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	    fi
+	    if test "$build_old_libs" = no; then
+	      oldlibs="$output_objdir/$libname.$libext"
+	      build_libtool_libs=module
+	      build_old_libs=yes
+	    else
+	      build_libtool_libs=no
+	    fi
+	  else
+	    echo "*** The inter-library dependencies that have been dropped here will be"
+	    echo "*** automatically added whenever a program is linked with this library"
+	    echo "*** or is declared to -dlopen it."
+
+	    if test $allow_undefined = no; then
+	      echo
+	      echo "*** Since this library must not contain undefined symbols,"
+	      echo "*** because either the platform does not support them or"
+	      echo "*** it was explicitly requested with -no-undefined,"
+	      echo "*** libtool will only create a static version of it."
+	      if test "$build_old_libs" = no; then
+		oldlibs="$output_objdir/$libname.$libext"
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  fi
+	fi
+	# Done checking deplibs!
+	deplibs=$newdeplibs
+      fi
+
+      # All the library-specific variables (install_libdir is set above).
+      library_names=
+      old_library=
+      dlname=
+
+      # Test again, we may have decided not to build it any more
+      if test "$build_libtool_libs" = yes; then
+	if test $hardcode_into_libs = yes; then
+	  # Hardcode the library paths
+	  hardcode_libdirs=
+	  dep_rpath=
+	  rpath="$finalize_rpath"
+	  test "$mode" != relink && rpath="$compile_rpath$rpath"
+	  for libdir in $rpath; do
+	    if test -n "$hardcode_libdir_flag_spec"; then
+	      if test -n "$hardcode_libdir_separator"; then
+		if test -z "$hardcode_libdirs"; then
+		  hardcode_libdirs="$libdir"
+		else
+		  # Just accumulate the unique libdirs.
+		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		    ;;
+		  *)
+		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		    ;;
+		  esac
+		fi
+	      else
+		eval flag=\"$hardcode_libdir_flag_spec\"
+		dep_rpath="$dep_rpath $flag"
+	      fi
+	    elif test -n "$runpath_var"; then
+	      case "$perm_rpath " in
+	      *" $libdir "*) ;;
+	      *) perm_rpath="$perm_rpath $libdir" ;;
+	      esac
+	    fi
+	  done
+	  # Substitute the hardcoded libdirs into the rpath.
+	  if test -n "$hardcode_libdir_separator" &&
+	     test -n "$hardcode_libdirs"; then
+	    libdir="$hardcode_libdirs"
+	    eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+	  fi
+	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
+	    # We should set the runpath_var.
+	    rpath=
+	    for dir in $perm_rpath; do
+	      rpath="$rpath$dir:"
+	    done
+	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+	  fi
+	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+	fi
+
+	shlibpath="$finalize_shlibpath"
+	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+	if test -n "$shlibpath"; then
+	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+	fi
+
+	# Get the real and link names of the library.
+	eval library_names=\"$library_names_spec\"
+	set dummy $library_names
+	realname="$2"
+	shift; shift
+
+	if test -n "$soname_spec"; then
+	  eval soname=\"$soname_spec\"
+	else
+	  soname="$realname"
+	fi
+	test -z "$dlname" && dlname=$soname
+
+	lib="$output_objdir/$realname"
+	for link
+	do
+	  linknames="$linknames $link"
+	done
+
+	# Ensure that we have .o objects for linkers which dislike .lo
+	# (e.g. aix) in case we are running --disable-static
+	for obj in $libobjs; do
+	  xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+	  if test "X$xdir" = "X$obj"; then
+	    xdir="."
+	  else
+	    xdir="$xdir"
+	  fi
+	  baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+	  oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
+	  if test ! -f $xdir/$oldobj; then
+	    $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
+	    $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
+	  fi
+	done
+
+	# Use standard objects if they are pic
+	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
+	# Prepare the list of exported symbols
+	if test -z "$export_symbols"; then
+	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+	    $show "generating symbol list for \`$libname.la'"
+	    export_symbols="$output_objdir/$libname.exp"
+	    $run $rm $export_symbols
+	    eval cmds=\"$export_symbols_cmds\"
+	    save_ifs="$IFS"; IFS='~'
+	    for cmd in $cmds; do
+	      IFS="$save_ifs"
+	      $show "$cmd"
+	      $run eval "$cmd" || exit $?
+	    done
+	    IFS="$save_ifs"
+	    if test -n "$export_symbols_regex"; then
+	      $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+	      $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
+	    fi
+	  fi
+	fi
+
+	if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+	fi
+
+	if test -n "$convenience"; then
+	  if test -n "$whole_archive_flag_spec"; then
+	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+	  else
+	    gentop="$output_objdir/${outputname}x"
+	    $show "${rm}r $gentop"
+	    $run ${rm}r "$gentop"
+	    $show "mkdir $gentop"
+	    $run mkdir "$gentop"
+	    status=$?
+	    if test $status -ne 0 && test ! -d "$gentop"; then
+	      exit $status
+	    fi
+	    generated="$generated $gentop"
+
+	    for xlib in $convenience; do
+	      # Extract the objects.
+	      case $xlib in
+	      [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+	      *) xabs=`pwd`"/$xlib" ;;
+	      esac
+	      xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+	      xdir="$gentop/$xlib"
+
+	      $show "${rm}r $xdir"
+	      $run ${rm}r "$xdir"
+	      $show "mkdir $xdir"
+	      $run mkdir "$xdir"
+	      status=$?
+	      if test $status -ne 0 && test ! -d "$xdir"; then
+		exit $status
+	      fi
+	      $show "(cd $xdir && $AR x $xabs)"
+	      $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+	      libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
+	    done
+	  fi
+	fi
+
+	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+	  eval flag=\"$thread_safe_flag_spec\"
+	  linker_flags="$linker_flags $flag"
+	fi
+
+	# Make a backup of the uninstalled library when relinking
+	if test "$mode" = relink; then
+	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
+	fi
+
+	# Do each of the archive commands.
+	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	  eval cmds=\"$archive_expsym_cmds\"
+	else
+	  save_deplibs="$deplibs"
+	  for conv in $convenience; do
+	    tmp_deplibs=
+	    for test_deplib in $deplibs; do
+	      if test "$test_deplib" != "$conv"; then
+		tmp_deplibs="$tmp_deplibs $test_deplib"
+	      fi
+	    done
+	    deplibs="$tmp_deplibs"
+	  done
+	  eval cmds=\"$archive_cmds\"
+	  deplibs="$save_deplibs"
+	fi
+	save_ifs="$IFS"; IFS='~'
+	for cmd in $cmds; do
+	  IFS="$save_ifs"
+	  $show "$cmd"
+	  $run eval "$cmd" || exit $?
+	done
+	IFS="$save_ifs"
+
+	# Restore the uninstalled library and exit
+	if test "$mode" = relink; then
+	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
+	  exit 0
+	fi
+
+	# Create links to the real library.
+	for linkname in $linknames; do
+	  if test "$realname" != "$linkname"; then
+	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
+	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
+	  fi
+	done
+
+	# If -module or -export-dynamic was specified, set the dlname.
+	if test "$module" = yes || test "$export_dynamic" = yes; then
+	  # On all known operating systems, these are identical.
+	  dlname="$soname"
+	fi
+      fi
+      ;;
+
+    obj)
+      if test -n "$deplibs"; then
+	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
+      fi
+
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$rpath"; then
+	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$xrpath"; then
+	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$vinfo"; then
+	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$release"; then
+	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
+      fi
+
+      case $output in
+      *.lo)
+	if test -n "$objs$old_deplibs"; then
+	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+	  exit 1
+	fi
+	libobj="$output"
+	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
+	;;
+      *)
+	libobj=
+	obj="$output"
+	;;
+      esac
+
+      # Delete the old objects.
+      $run $rm $obj $libobj
+
+      # Objects from convenience libraries.  This assumes
+      # single-version convenience libraries.  Whenever we create
+      # different ones for PIC/non-PIC, this we'll have to duplicate
+      # the extraction.
+      reload_conv_objs=
+      gentop=
+      # reload_cmds runs $LD directly, so let us get rid of
+      # -Wl from whole_archive_flag_spec
+      wl=
+
+      if test -n "$convenience"; then
+	if test -n "$whole_archive_flag_spec"; then
+	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
+	else
+	  gentop="$output_objdir/${obj}x"
+	  $show "${rm}r $gentop"
+	  $run ${rm}r "$gentop"
+	  $show "mkdir $gentop"
+	  $run mkdir "$gentop"
+	  status=$?
+	  if test $status -ne 0 && test ! -d "$gentop"; then
+	    exit $status
+	  fi
+	  generated="$generated $gentop"
+
+	  for xlib in $convenience; do
+	    # Extract the objects.
+	    case $xlib in
+	    [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+	    *) xabs=`pwd`"/$xlib" ;;
+	    esac
+	    xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+	    xdir="$gentop/$xlib"
+
+	    $show "${rm}r $xdir"
+	    $run ${rm}r "$xdir"
+	    $show "mkdir $xdir"
+	    $run mkdir "$xdir"
+	    status=$?
+	    if test $status -ne 0 && test ! -d "$xdir"; then
+	      exit $status
+	    fi
+	    $show "(cd $xdir && $AR x $xabs)"
+	    $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+	    reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
+	  done
+	fi
+      fi
+
+      # Create the old-style object.
+      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+      output="$obj"
+      eval cmds=\"$reload_cmds\"
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+	IFS="$save_ifs"
+	$show "$cmd"
+	$run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+
+      # Exit if we aren't doing a library object file.
+      if test -z "$libobj"; then
+	if test -n "$gentop"; then
+	  $show "${rm}r $gentop"
+	  $run ${rm}r $gentop
+	fi
+
+	exit 0
+      fi
+
+      if test "$build_libtool_libs" != yes; then
+	if test -n "$gentop"; then
+	  $show "${rm}r $gentop"
+	  $run ${rm}r $gentop
+	fi
+
+	# Create an invalid libtool object if no PIC, so that we don't
+	# accidentally link it into a program.
+	$show "echo timestamp > $libobj"
+	$run eval "echo timestamp > $libobj" || exit $?
+	exit 0
+      fi
+
+      if test -n "$pic_flag" || test "$pic_mode" != default; then
+	# Only do commands if we really have different PIC objects.
+	reload_objs="$libobjs $reload_conv_objs"
+	output="$libobj"
+	eval cmds=\"$reload_cmds\"
+	save_ifs="$IFS"; IFS='~'
+	for cmd in $cmds; do
+	  IFS="$save_ifs"
+	  $show "$cmd"
+	  $run eval "$cmd" || exit $?
+	done
+	IFS="$save_ifs"
+      else
+	# Just create a symlink.
+	$show $rm $libobj
+	$run $rm $libobj
+	xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
+	if test "X$xdir" = "X$libobj"; then
+	  xdir="."
+	else
+	  xdir="$xdir"
+	fi
+	baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
+	oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
+	$show "(cd $xdir && $LN_S $oldobj $baseobj)"
+	$run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
+      fi
+
+      if test -n "$gentop"; then
+	$show "${rm}r $gentop"
+	$run ${rm}r $gentop
+      fi
+
+      exit 0
+      ;;
+
+    prog)
+      case $host in
+	*cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
+      esac
+      if test -n "$vinfo"; then
+	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
+      fi
+
+      if test -n "$release"; then
+	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
+      fi
+
+      if test "$preload" = yes; then
+	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
+	   test "$dlopen_self_static" = unknown; then
+	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+	fi
+      fi
+
+      case $host in
+      *-*-rhapsody* | *-*-darwin1.[012])
+	# On Rhapsody replace the C library is the System framework
+	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+	case $host in
+	*darwin*)
+	  # Don't allow lazy linking, it breaks C++ global constructors
+	  compile_command="$compile_command ${wl}-bind_at_load"
+	  finalize_command="$finalize_command ${wl}-bind_at_load"
+	  ;;
+	esac
+	;;
+      esac
+
+      compile_command="$compile_command $compile_deplibs"
+      finalize_command="$finalize_command $finalize_deplibs"
+
+      if test -n "$rpath$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	for libdir in $rpath $xrpath; do
+	  # This is the magic to use -rpath.
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  esac
+	done
+      fi
+
+      # Now hardcode the library paths
+      rpath=
+      hardcode_libdirs=
+      for libdir in $compile_rpath $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    rpath="$rpath $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) perm_rpath="$perm_rpath $libdir" ;;
+	  esac
+	fi
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  case :$dllsearchpath: in
+	  *":$libdir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$libdir";;
+	  esac
+	  ;;
+	esac
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      compile_rpath="$rpath"
+
+      rpath=
+      hardcode_libdirs=
+      for libdir in $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    rpath="$rpath $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$finalize_perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+	  esac
+	fi
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      finalize_rpath="$rpath"
+
+      if test -n "$libobjs" && test "$build_old_libs" = yes; then
+	# Transform all the library objects into standard objects.
+	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+      fi
+
+      dlsyms=
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	if test -n "$NM" && test -n "$global_symbol_pipe"; then
+	  dlsyms="${outputname}S.c"
+	else
+	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+	fi
+      fi
+
+      if test -n "$dlsyms"; then
+	case $dlsyms in
+	"") ;;
+	*.c)
+	  # Discover the nlist of each of the dlfiles.
+	  nlist="$output_objdir/${outputname}.nm"
+
+	  $show "$rm $nlist ${nlist}S ${nlist}T"
+	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
+
+	  # Parse the name list into a source file.
+	  $show "creating $output_objdir/$dlsyms"
+
+	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define lt_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+	  if test "$dlself" = yes; then
+	    $show "generating symbol list for \`$output'"
+
+	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
+
+	    # Add our own program objects to the symbol list.
+	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	    for arg in $progfiles; do
+	      $show "extracting global C symbols from \`$arg'"
+	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+	    done
+
+	    if test -n "$exclude_expsyms"; then
+	      $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+	      $run eval '$mv "$nlist"T "$nlist"'
+	    fi
+
+	    if test -n "$export_symbols_regex"; then
+	      $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+	      $run eval '$mv "$nlist"T "$nlist"'
+	    fi
+
+	    # Prepare the list of exported symbols
+	    if test -z "$export_symbols"; then
+	      export_symbols="$output_objdir/$output.exp"
+	      $run $rm $export_symbols
+	      $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+	    else
+	      $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
+	      $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
+	      $run eval 'mv "$nlist"T "$nlist"'
+	    fi
+	  fi
+
+	  for arg in $dlprefiles; do
+	    $show "extracting global C symbols from \`$arg'"
+	    name=`echo "$arg" | ${SED} -e 's%^.*/%%'`
+	    $run eval 'echo ": $name " >> "$nlist"'
+	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+	  done
+
+	  if test -z "$run"; then
+	    # Make sure we have at least an empty file.
+	    test -f "$nlist" || : > "$nlist"
+
+	    if test -n "$exclude_expsyms"; then
+	      egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+	      $mv "$nlist"T "$nlist"
+	    fi
+
+	    # Try sorting and uniquifying the output.
+	    if grep -v "^: " < "$nlist" |
+		if sort -k 3 </dev/null >/dev/null 2>&1; then
+		  sort -k 3
+		else
+		  sort +2
+		fi |
+		uniq > "$nlist"S; then
+	      :
+	    else
+	      grep -v "^: " < "$nlist" > "$nlist"S
+	    fi
+
+	    if test -f "$nlist"S; then
+	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
+	    else
+	      echo '/* NONE */' >> "$output_objdir/$dlsyms"
+	    fi
+
+	    $echo >> "$output_objdir/$dlsyms" "\
+
+#undef lt_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr address;
+}
+lt_preloaded_symbols[] =
+{\
+"
+
+	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
+
+	    $echo >> "$output_objdir/$dlsyms" "\
+  {0, (lt_ptr) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+	  fi
+
+	  pic_flag_for_symtable=
+	  case $host in
+	  # compiling the symbol table file with pic_flag works around
+	  # a FreeBSD bug that causes programs to crash when -lm is
+	  # linked before any other PIC object.  But we must not use
+	  # pic_flag when linking with -static.  The problem exists in
+	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+	    case "$compile_command " in
+	    *" -static "*) ;;
+	    *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
+	    esac;;
+	  *-*-hpux*)
+	    case "$compile_command " in
+	    *" -static "*) ;;
+	    *) pic_flag_for_symtable=" $pic_flag -DPIC";;
+	    esac
+	  esac
+
+	  # Now compile the dynamic symbol file.
+	  $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+	  $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+
+	  # Clean up the generated files.
+	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+
+	  # Transform the symbol file into the correct name.
+	  compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+	  finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+	  ;;
+	*)
+	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+	  exit 1
+	  ;;
+	esac
+      else
+	# We keep going just in case the user didn't refer to
+	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
+	# really was required.
+
+	# Nullify the symbol file.
+	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+      fi
+
+      if test $need_relink = no || test "$build_libtool_libs" != yes; then
+	# Replace the output file specification.
+	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	link_command="$compile_command$compile_rpath"
+
+	# We have no uninstalled library dependencies, so finalize right now.
+	$show "$link_command"
+	$run eval "$link_command"
+	status=$?
+
+	# Delete the generated files.
+	if test -n "$dlsyms"; then
+	  $show "$rm $output_objdir/${outputname}S.${objext}"
+	  $run $rm "$output_objdir/${outputname}S.${objext}"
+	fi
+
+	exit $status
+      fi
+
+      if test -n "$shlibpath_var"; then
+	# We should set the shlibpath_var
+	rpath=
+	for dir in $temp_rpath; do
+	  case $dir in
+	  [\\/]* | [A-Za-z]:[\\/]*)
+	    # Absolute path.
+	    rpath="$rpath$dir:"
+	    ;;
+	  *)
+	    # Relative path: add a thisdir entry.
+	    rpath="$rpath\$thisdir/$dir:"
+	    ;;
+	  esac
+	done
+	temp_rpath="$rpath"
+      fi
+
+      if test -n "$compile_shlibpath$finalize_shlibpath"; then
+	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+      fi
+      if test -n "$finalize_shlibpath"; then
+	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+      fi
+
+      compile_var=
+      finalize_var=
+      if test -n "$runpath_var"; then
+	if test -n "$perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $perm_rpath; do
+	    rpath="$rpath$dir:"
+	  done
+	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+	if test -n "$finalize_perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $finalize_perm_rpath; do
+	    rpath="$rpath$dir:"
+	  done
+	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+      fi
+
+      if test "$no_install" = yes; then
+	# We don't need to create a wrapper script.
+	link_command="$compile_var$compile_command$compile_rpath"
+	# Replace the output file specification.
+	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	# Delete the old output file.
+	$run $rm $output
+	# Link the executable and exit
+	$show "$link_command"
+	$run eval "$link_command" || exit $?
+	exit 0
+      fi
+
+      if test "$hardcode_action" = relink; then
+	# Fast installation is not supported
+	link_command="$compile_var$compile_command$compile_rpath"
+	relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
+	$echo "$modename: \`$output' will be relinked during installation" 1>&2
+      else
+	if test "$fast_install" != no; then
+	  link_command="$finalize_var$compile_command$finalize_rpath"
+	  if test "$fast_install" = yes; then
+	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+	  else
+	    # fast_install is set to needless
+	    relink_command=
+	  fi
+	else
+	  link_command="$compile_var$compile_command$compile_rpath"
+	  relink_command="$finalize_var$finalize_command$finalize_rpath"
+	fi
+      fi
+
+      # Replace the output file specification.
+      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+      # Delete the old output files.
+      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+      $show "$link_command"
+      $run eval "$link_command" || exit $?
+
+      # Now create the wrapper script.
+      $show "creating $output"
+
+      # Quote the relink command for shipping.
+      if test -n "$relink_command"; then
+	# Preserve any variables that may affect compiler behavior
+	for var in $variables_saved_for_relink; do
+	  if eval test -z \"\${$var+set}\"; then
+	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+	  elif eval var_value=\$$var; test -z "$var_value"; then
+	    relink_command="$var=; export $var; $relink_command"
+	  else
+	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
+	  fi
+	done
+	relink_command="(cd `pwd`; $relink_command)"
+	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Quote $echo for shipping.
+      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
+	case $0 in
+	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
+	*) qecho="$SHELL `pwd`/$0 --fallback-echo";;
+	esac
+	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
+      else
+	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Only actually do things if our run command is non-null.
+      if test -z "$run"; then
+	# win32 will think the script is a binary if it has
+	# a .exe suffix, so we strip it off here.
+	case $output in
+	  *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;;
+	esac
+	# test for cygwin because mv fails w/o .exe extensions
+	case $host in
+	  *cygwin*) exeext=.exe ;;
+	  *) exeext= ;;
+	esac
+	$rm $output
+	trap "$rm $output; exit 1" 1 2 15
+
+	$echo > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+  # install mode needs the following variable:
+  notinst_deplibs='$notinst_deplibs'
+else
+  # When we are sourced in execute mode, \$file and \$echo are already set.
+  if test \"\$libtool_execute_magic\" != \"$magic\"; then
+    echo=\"$qecho\"
+    file=\"\$0\"
+    # Make sure echo works.
+    if test \"X\$1\" = X--no-reexec; then
+      # Discard the --no-reexec flag, and continue.
+      shift
+    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
+      # Yippee, \$echo works!
+      :
+    else
+      # Restart under the correct shell, and then maybe \$echo will work.
+      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+    fi
+  fi\
+"
+	$echo >> $output "\
+
+  # Find the directory that this script lives in.
+  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+  # Follow symbolic links until we get to the real thisdir.
+  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+  while test -n \"\$file\"; do
+    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+    # If there was a directory component, then change thisdir.
+    if test \"x\$destdir\" != \"x\$file\"; then
+      case \"\$destdir\" in
+      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+      *) thisdir=\"\$thisdir/\$destdir\" ;;
+      esac
+    fi
+
+    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+  done
+
+  # Try to get the absolute directory name.
+  absdir=\`cd \"\$thisdir\" && pwd\`
+  test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+	if test "$fast_install" = yes; then
+	  echo >> $output "\
+  program=lt-'$outputname'$exeext
+  progdir=\"\$thisdir/$objdir\"
+
+  if test ! -f \"\$progdir/\$program\" || \\
+     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+    file=\"\$\$-\$program\"
+
+    if test ! -d \"\$progdir\"; then
+      $mkdir \"\$progdir\"
+    else
+      $rm \"\$progdir/\$file\"
+    fi"
+
+	  echo >> $output "\
+
+    # relink executable if necessary
+    if test -n \"\$relink_command\"; then
+      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+      else
+	$echo \"\$relink_command_output\" >&2
+	$rm \"\$progdir/\$file\"
+	exit 1
+      fi
+    fi
+
+    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+    { $rm \"\$progdir/\$program\";
+      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+    $rm \"\$progdir/\$file\"
+  fi"
+	else
+	  echo >> $output "\
+  program='$outputname'
+  progdir=\"\$thisdir/$objdir\"
+"
+	fi
+
+	echo >> $output "\
+
+  if test -f \"\$progdir/\$program\"; then"
+
+	# Export our shlibpath_var if we have one.
+	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+	  $echo >> $output "\
+    # Add our own library path to $shlibpath_var
+    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+    # Some systems cannot cope with colon-terminated $shlibpath_var
+    # The second colon is a workaround for a bug in BeOS R4 ${SED}
+    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+    export $shlibpath_var
+"
+	fi
+
+	# fixup the dll searchpath if we need to.
+	if test -n "$dllsearchpath"; then
+	  $echo >> $output "\
+    # Add the dll search path components to the executable PATH
+    PATH=$dllsearchpath:\$PATH
+"
+	fi
+
+	$echo >> $output "\
+    if test \"\$libtool_execute_magic\" != \"$magic\"; then
+      # Run the actual program with our arguments.
+"
+	case $host in
+	# win32 systems need to use the prog path for dll
+	# lookup to work
+	*-*-cygwin* | *-*-pw32*)
+	  $echo >> $output "\
+      exec \$progdir/\$program \${1+\"\$@\"}
+"
+	  ;;
+
+	# Backslashes separate directories on plain windows
+	*-*-mingw | *-*-os2*)
+	  $echo >> $output "\
+      exec \$progdir\\\\\$program \${1+\"\$@\"}
+"
+	  ;;
+
+	*)
+	  $echo >> $output "\
+      # Export the path to the program.
+      PATH=\"\$progdir:\$PATH\"
+      export PATH
+
+      exec \$program \${1+\"\$@\"}
+"
+	  ;;
+	esac
+	$echo >> $output "\
+      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
+      exit 1
+    fi
+  else
+    # The program doesn't exist.
+    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
+    \$echo \"This script is just a wrapper for \$program.\" 1>&2
+    echo \"See the $PACKAGE documentation for more information.\" 1>&2
+    exit 1
+  fi
+fi\
+"
+	chmod +x $output
+      fi
+      exit 0
+      ;;
+    esac
+
+    # See if we need to build an old-fashioned archive.
+    for oldlib in $oldlibs; do
+
+      if test "$build_libtool_libs" = convenience; then
+	oldobjs="$libobjs_save"
+	addlibs="$convenience"
+	build_libtool_libs=no
+      else
+	if test "$build_libtool_libs" = module; then
+	  oldobjs="$libobjs_save"
+	  build_libtool_libs=no
+	else
+	  oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
+	fi
+	addlibs="$old_convenience"
+      fi
+
+      if test -n "$addlibs"; then
+	gentop="$output_objdir/${outputname}x"
+	$show "${rm}r $gentop"
+	$run ${rm}r "$gentop"
+	$show "mkdir $gentop"
+	$run mkdir "$gentop"
+	status=$?
+	if test $status -ne 0 && test ! -d "$gentop"; then
+	  exit $status
+	fi
+	generated="$generated $gentop"
+
+	# Add in members from convenience archives.
+	for xlib in $addlibs; do
+	  # Extract the objects.
+	  case $xlib in
+	  [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+	  *) xabs=`pwd`"/$xlib" ;;
+	  esac
+	  xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+	  xdir="$gentop/$xlib"
+
+	  $show "${rm}r $xdir"
+	  $run ${rm}r "$xdir"
+	  $show "mkdir $xdir"
+	  $run mkdir "$xdir"
+	  status=$?
+	  if test $status -ne 0 && test ! -d "$xdir"; then
+	    exit $status
+	  fi
+	  $show "(cd $xdir && $AR x $xabs)"
+	  $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+	  oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
+	done
+      fi
+
+      # Do each command in the archive commands.
+      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+	eval cmds=\"$old_archive_from_new_cmds\"
+      else
+	# Ensure that we have .o objects in place in case we decided
+	# not to build a shared library, and have fallen back to building
+	# static libs even though --disable-static was passed!
+	for oldobj in $oldobjs; do
+	  if test ! -f $oldobj; then
+	    xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
+	    if test "X$xdir" = "X$oldobj"; then
+	      xdir="."
+	    else
+	      xdir="$xdir"
+	    fi
+	    baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
+	    obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
+	    $show "(cd $xdir && ${LN_S} $obj $baseobj)"
+	    $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
+	  fi
+	done
+
+	eval cmds=\"$old_archive_cmds\"
+      fi
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+	IFS="$save_ifs"
+	$show "$cmd"
+	$run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+    done
+
+    if test -n "$generated"; then
+      $show "${rm}r$generated"
+      $run ${rm}r$generated
+    fi
+
+    # Now create the libtool archive.
+    case $output in
+    *.la)
+      old_library=
+      test "$build_old_libs" = yes && old_library="$libname.$libext"
+      $show "creating $output"
+
+      # Preserve any variables that may affect compiler behavior
+      for var in $variables_saved_for_relink; do
+	if eval test -z \"\${$var+set}\"; then
+	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+	elif eval var_value=\$$var; test -z "$var_value"; then
+	  relink_command="$var=; export $var; $relink_command"
+	else
+	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
+	fi
+      done
+      # Quote the link command for shipping.
+      relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
+      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+
+      # Only create the output if not a dry run.
+      if test -z "$run"; then
+	for installed in no yes; do
+	  if test "$installed" = yes; then
+	    if test -z "$install_libdir"; then
+	      break
+	    fi
+	    output="$output_objdir/$outputname"i
+	    # Replace all uninstalled libtool libraries with the installed ones
+	    newdependency_libs=
+	    for deplib in $dependency_libs; do
+	      case $deplib in
+	      *.la)
+		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		if test -z "$libdir"; then
+		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+		  exit 1
+		fi
+		newdependency_libs="$newdependency_libs $libdir/$name"
+		;;
+	      *) newdependency_libs="$newdependency_libs $deplib" ;;
+	      esac
+	    done
+	    dependency_libs="$newdependency_libs"
+	    newdlfiles=
+	    for lib in $dlfiles; do
+	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+	      if test -z "$libdir"; then
+		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+		exit 1
+	      fi
+	      newdlfiles="$newdlfiles $libdir/$name"
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+	      if test -z "$libdir"; then
+		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+		exit 1
+	      fi
+	      newdlprefiles="$newdlprefiles $libdir/$name"
+	    done
+	    dlprefiles="$newdlprefiles"
+	  fi
+	  $rm $output
+	  # place dlname in correct position for cygwin
+	  tdlname=$dlname
+	  case $host,$output,$installed,$module,$dlname in
+	    *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+	  esac
+	  $echo > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+	  if test "$installed" = no && test $need_relink = yes; then
+	    $echo >> $output "\
+relink_command=\"$relink_command\""
+	  fi
+	done
+      fi
+
+      # Do a symbolic link so that the libtool archive can be found in
+      # LD_LIBRARY_PATH before the program is installed.
+      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
+      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
+      ;;
+    esac
+    exit 0
+    ;;
+
+  # libtool install mode
+  install)
+    modename="$modename: install"
+
+    # There may be an optional sh(1) argument at the beginning of
+    # install_prog (especially on Windows NT).
+    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+       # Allow the use of GNU shtool's install command.
+       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
+      # Aesthetically quote it.
+      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
+	arg="\"$arg\""
+	;;
+      esac
+      install_prog="$arg "
+      arg="$1"
+      shift
+    else
+      install_prog=
+      arg="$nonopt"
+    fi
+
+    # The real first argument should be the name of the installation program.
+    # Aesthetically quote it.
+    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+    case $arg in
+    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
+      arg="\"$arg\""
+      ;;
+    esac
+    install_prog="$install_prog$arg"
+
+    # We need to accept at least all the BSD install flags.
+    dest=
+    files=
+    opts=
+    prev=
+    install_type=
+    isdir=no
+    stripme=
+    for arg
+    do
+      if test -n "$dest"; then
+	files="$files $dest"
+	dest="$arg"
+	continue
+      fi
+
+      case $arg in
+      -d) isdir=yes ;;
+      -f) prev="-f" ;;
+      -g) prev="-g" ;;
+      -m) prev="-m" ;;
+      -o) prev="-o" ;;
+      -s)
+	stripme=" -s"
+	continue
+	;;
+      -*) ;;
+
+      *)
+	# If the previous option needed an argument, then skip it.
+	if test -n "$prev"; then
+	  prev=
+	else
+	  dest="$arg"
+	  continue
+	fi
+	;;
+      esac
+
+      # Aesthetically quote the argument.
+      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
+	arg="\"$arg\""
+	;;
+      esac
+      install_prog="$install_prog $arg"
+    done
+
+    if test -z "$install_prog"; then
+      $echo "$modename: you must specify an install program" 1>&2
+      $echo "$help" 1>&2
+      exit 1
+    fi
+
+    if test -n "$prev"; then
+      $echo "$modename: the \`$prev' option requires an argument" 1>&2
+      $echo "$help" 1>&2
+      exit 1
+    fi
+
+    if test -z "$files"; then
+      if test -z "$dest"; then
+	$echo "$modename: no file or destination specified" 1>&2
+      else
+	$echo "$modename: you must specify a destination" 1>&2
+      fi
+      $echo "$help" 1>&2
+      exit 1
+    fi
+
+    # Strip any trailing slash from the destination.
+    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+    # Check to see that the destination is a directory.
+    test -d "$dest" && isdir=yes
+    if test "$isdir" = yes; then
+      destdir="$dest"
+      destname=
+    else
+      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+      test "X$destdir" = "X$dest" && destdir=.
+      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+      # Not a directory, so check to see that there is only one file specified.
+      set dummy $files
+      if test $# -gt 2; then
+	$echo "$modename: \`$dest' is not a directory" 1>&2
+	$echo "$help" 1>&2
+	exit 1
+      fi
+    fi
+    case $destdir in
+    [\\/]* | [A-Za-z]:[\\/]*) ;;
+    *)
+      for file in $files; do
+	case $file in
+	*.lo) ;;
+	*)
+	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+	  $echo "$help" 1>&2
+	  exit 1
+	  ;;
+	esac
+      done
+      ;;
+    esac
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    staticlibs=
+    future_libdirs=
+    current_libdirs=
+    for file in $files; do
+
+      # Do each installation.
+      case $file in
+      *.$libext)
+	# Do the static libraries later.
+	staticlibs="$staticlibs $file"
+	;;
+
+      *.la)
+	# Check to see that this really is a libtool archive.
+	if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+	else
+	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+	  $echo "$help" 1>&2
+	  exit 1
+	fi
+
+	library_names=
+	old_library=
+	relink_command=
+	# If there is no directory component, then add one.
+	case $file in
+	*/* | *\\*) . $file ;;
+	*) . ./$file ;;
+	esac
+
+	# Add the libdir to current_libdirs if it is the destination.
+	if test "X$destdir" = "X$libdir"; then
+	  case "$current_libdirs " in
+	  *" $libdir "*) ;;
+	  *) current_libdirs="$current_libdirs $libdir" ;;
+	  esac
+	else
+	  # Note the libdir as a future libdir.
+	  case "$future_libdirs " in
+	  *" $libdir "*) ;;
+	  *) future_libdirs="$future_libdirs $libdir" ;;
+	  esac
+	fi
+
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
+	test "X$dir" = "X$file/" && dir=
+	dir="$dir$objdir"
+
+	if test -n "$relink_command"; then
+          # Determine the prefix the user has applied to our future dir.
+          inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
+ 
+          # Don't allow the user to place us outside of our expected
+          # location b/c this prevents finding dependent libraries that
+          # are installed to the same prefix.
+          if test "$inst_prefix_dir" = "$destdir"; then
+            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
+            exit 1
+          fi
+ 
+          if test -n "$inst_prefix_dir"; then
+            # Stick the inst_prefix_dir data into the link command.
+            relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+          else
+            relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
+          fi
+
+	  $echo "$modename: warning: relinking \`$file'" 1>&2
+	  $show "$relink_command"
+	  if $run eval "$relink_command"; then :
+	  else
+	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+	    exit 1
+	  fi
+	fi
+
+	# See the names of the shared library.
+	set dummy $library_names
+	if test -n "$2"; then
+	  realname="$2"
+	  shift
+	  shift
+
+	  srcname="$realname"
+	  test -n "$relink_command" && srcname="$realname"T
+
+	  # Install the shared library and build the symlinks.
+	  $show "$install_prog $dir/$srcname $destdir/$realname"
+	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
+	  if test -n "$stripme" && test -n "$striplib"; then
+	    $show "$striplib $destdir/$realname"
+	    $run eval "$striplib $destdir/$realname" || exit $?
+	  fi
+
+	  if test $# -gt 0; then
+	    # Delete the old symlinks, and create new ones.
+	    for linkname
+	    do
+	      if test "$linkname" != "$realname"; then
+		$show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+		$run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+	      fi
+	    done
+	  fi
+
+	  # Do each command in the postinstall commands.
+	  lib="$destdir/$realname"
+	  eval cmds=\"$postinstall_cmds\"
+	  save_ifs="$IFS"; IFS='~'
+	  for cmd in $cmds; do
+	    IFS="$save_ifs"
+	    $show "$cmd"
+	    $run eval "$cmd" || exit $?
+	  done
+	  IFS="$save_ifs"
+	fi
+
+	# Install the pseudo-library for information purposes.
+	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+	instname="$dir/$name"i
+	$show "$install_prog $instname $destdir/$name"
+	$run eval "$install_prog $instname $destdir/$name" || exit $?
+
+	# Maybe install the static library, too.
+	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+	;;
+
+      *.lo)
+	# Install (i.e. copy) a libtool object.
+
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+	  destfile="$destdir/$destfile"
+	fi
+
+	# Deduce the name of the destination old-style object file.
+	case $destfile in
+	*.lo)
+	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
+	  ;;
+	*.$objext)
+	  staticdest="$destfile"
+	  destfile=
+	  ;;
+	*)
+	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+	  $echo "$help" 1>&2
+	  exit 1
+	  ;;
+	esac
+
+	# Install the libtool object if requested.
+	if test -n "$destfile"; then
+	  $show "$install_prog $file $destfile"
+	  $run eval "$install_prog $file $destfile" || exit $?
+	fi
+
+	# Install the old object if enabled.
+	if test "$build_old_libs" = yes; then
+	  # Deduce the name of the old-style object file.
+	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
+
+	  $show "$install_prog $staticobj $staticdest"
+	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+	fi
+	exit 0
+	;;
+
+      *)
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+	  destfile="$destdir/$destfile"
+	fi
+
+	# Do a test to see if this is really a libtool program.
+	case $host in
+	*cygwin*|*mingw*)
+	    wrapper=`echo $file | ${SED} -e 's,.exe$,,'`
+	    ;;
+	*)
+	    wrapper=$file
+	    ;;
+	esac
+	if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
+	  notinst_deplibs=
+	  relink_command=
+
+	  # If there is no directory component, then add one.
+	  case $file in
+	  */* | *\\*) . $wrapper ;;
+	  *) . ./$wrapper ;;
+	  esac
+
+	  # Check the variables that should have been set.
+	  if test -z "$notinst_deplibs"; then
+	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
+	    exit 1
+	  fi
+
+	  finalize=yes
+	  for lib in $notinst_deplibs; do
+	    # Check to see that each library is installed.
+	    libdir=
+	    if test -f "$lib"; then
+	      # If there is no directory component, then add one.
+	      case $lib in
+	      */* | *\\*) . $lib ;;
+	      *) . ./$lib ;;
+	      esac
+	    fi
+	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+	    if test -n "$libdir" && test ! -f "$libfile"; then
+	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+	      finalize=no
+	    fi
+	  done
+
+	  relink_command=
+	  # If there is no directory component, then add one.
+	  case $file in
+	  */* | *\\*) . $wrapper ;;
+	  *) . ./$wrapper ;;
+	  esac
+
+	  outputname=
+	  if test "$fast_install" = no && test -n "$relink_command"; then
+	    if test "$finalize" = yes && test -z "$run"; then
+	      tmpdir="/tmp"
+	      test -n "$TMPDIR" && tmpdir="$TMPDIR"
+	      tmpdir="$tmpdir/libtool-$$"
+	      if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
+	      else
+		$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
+		continue
+	      fi
+	      file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+	      outputname="$tmpdir/$file"
+	      # Replace the output file specification.
+	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+
+	      $show "$relink_command"
+	      if $run eval "$relink_command"; then :
+	      else
+		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+		${rm}r "$tmpdir"
+		continue
+	      fi
+	      file="$outputname"
+	    else
+	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
+	    fi
+	  else
+	    # Install the binary that we compiled earlier.
+	    file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+	  fi
+	fi
+
+	# remove .exe since cygwin /usr/bin/install will append another
+	# one anyways
+	case $install_prog,$host in
+	/usr/bin/install*,*cygwin*)
+	  case $file:$destfile in
+	  *.exe:*.exe)
+	    # this is ok
+	    ;;
+	  *.exe:*)
+	    destfile=$destfile.exe
+	    ;;
+	  *:*.exe)
+	    destfile=`echo $destfile | ${SED} -e 's,.exe$,,'`
+	    ;;
+	  esac
+	  ;;
+	esac
+	$show "$install_prog$stripme $file $destfile"
+	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
+	test -n "$outputname" && ${rm}r "$tmpdir"
+	;;
+      esac
+    done
+
+    for file in $staticlibs; do
+      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+      # Set up the ranlib parameters.
+      oldlib="$destdir/$name"
+
+      $show "$install_prog $file $oldlib"
+      $run eval "$install_prog \$file \$oldlib" || exit $?
+
+      if test -n "$stripme" && test -n "$striplib"; then
+	$show "$old_striplib $oldlib"
+	$run eval "$old_striplib $oldlib" || exit $?
+      fi
+
+      # Do each command in the postinstall commands.
+      eval cmds=\"$old_postinstall_cmds\"
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+	IFS="$save_ifs"
+	$show "$cmd"
+	$run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+    done
+
+    if test -n "$future_libdirs"; then
+      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+    fi
+
+    if test -n "$current_libdirs"; then
+      # Maybe just do a dry run.
+      test -n "$run" && current_libdirs=" -n$current_libdirs"
+      exec_cmd='$SHELL $0 --finish$current_libdirs'
+    else
+      exit 0
+    fi
+    ;;
+
+  # libtool finish mode
+  finish)
+    modename="$modename: finish"
+    libdirs="$nonopt"
+    admincmds=
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      for dir
+      do
+	libdirs="$libdirs $dir"
+      done
+
+      for libdir in $libdirs; do
+	if test -n "$finish_cmds"; then
+	  # Do each command in the finish commands.
+	  eval cmds=\"$finish_cmds\"
+	  save_ifs="$IFS"; IFS='~'
+	  for cmd in $cmds; do
+	    IFS="$save_ifs"
+	    $show "$cmd"
+	    $run eval "$cmd" || admincmds="$admincmds
+       $cmd"
+	  done
+	  IFS="$save_ifs"
+	fi
+	if test -n "$finish_eval"; then
+	  # Do the single finish_eval.
+	  eval cmds=\"$finish_eval\"
+	  $run eval "$cmds" || admincmds="$admincmds
+       $cmds"
+	fi
+      done
+    fi
+
+    # Exit here if they wanted silent mode.
+    test "$show" = ":" && exit 0
+
+    echo "----------------------------------------------------------------------"
+    echo "Libraries have been installed in:"
+    for libdir in $libdirs; do
+      echo "   $libdir"
+    done
+    echo
+    echo "If you ever happen to want to link against installed libraries"
+    echo "in a given directory, LIBDIR, you must either use libtool, and"
+    echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+    echo "flag during linking and do at least one of the following:"
+    if test -n "$shlibpath_var"; then
+      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+      echo "     during execution"
+    fi
+    if test -n "$runpath_var"; then
+      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
+      echo "     during linking"
+    fi
+    if test -n "$hardcode_libdir_flag_spec"; then
+      libdir=LIBDIR
+      eval flag=\"$hardcode_libdir_flag_spec\"
+
+      echo "   - use the \`$flag' linker flag"
+    fi
+    if test -n "$admincmds"; then
+      echo "   - have your system administrator run these commands:$admincmds"
+    fi
+    if test -f /etc/ld.so.conf; then
+      echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+    fi
+    echo
+    echo "See any operating system documentation about shared libraries for"
+    echo "more information, such as the ld(1) and ld.so(8) manual pages."
+    echo "----------------------------------------------------------------------"
+    exit 0
+    ;;
+
+  # libtool execute mode
+  execute)
+    modename="$modename: execute"
+
+    # The first argument is the command name.
+    cmd="$nonopt"
+    if test -z "$cmd"; then
+      $echo "$modename: you must specify a COMMAND" 1>&2
+      $echo "$help"
+      exit 1
+    fi
+
+    # Handle -dlopen flags immediately.
+    for file in $execute_dlfiles; do
+      if test ! -f "$file"; then
+	$echo "$modename: \`$file' is not a file" 1>&2
+	$echo "$help" 1>&2
+	exit 1
+      fi
+
+      dir=
+      case $file in
+      *.la)
+	# Check to see that this really is a libtool archive.
+	if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+	else
+	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+	  $echo "$help" 1>&2
+	  exit 1
+	fi
+
+	# Read the libtool library.
+	dlname=
+	library_names=
+
+	# If there is no directory component, then add one.
+	case $file in
+	*/* | *\\*) . $file ;;
+	*) . ./$file ;;
+	esac
+
+	# Skip this library if it cannot be dlopened.
+	if test -z "$dlname"; then
+	  # Warn if it was a shared library.
+	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+	  continue
+	fi
+
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$dir" = "X$file" && dir=.
+
+	if test -f "$dir/$objdir/$dlname"; then
+	  dir="$dir/$objdir"
+	else
+	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+	  exit 1
+	fi
+	;;
+
+      *.lo)
+	# Just add the directory containing the .lo file.
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$dir" = "X$file" && dir=.
+	;;
+
+      *)
+	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
+	continue
+	;;
+      esac
+
+      # Get the absolute pathname.
+      absdir=`cd "$dir" && pwd`
+      test -n "$absdir" && dir="$absdir"
+
+      # Now add the directory to shlibpath_var.
+      if eval "test -z \"\$$shlibpath_var\""; then
+	eval "$shlibpath_var=\"\$dir\""
+      else
+	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+      fi
+    done
+
+    # This variable tells wrapper scripts just to set shlibpath_var
+    # rather than running their programs.
+    libtool_execute_magic="$magic"
+
+    # Check if any of the arguments is a wrapper script.
+    args=
+    for file
+    do
+      case $file in
+      -*) ;;
+      *)
+	# Do a test to see if this is really a libtool program.
+	if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	  # If there is no directory component, then add one.
+	  case $file in
+	  */* | *\\*) . $file ;;
+	  *) . ./$file ;;
+	  esac
+
+	  # Transform arg to wrapped name.
+	  file="$progdir/$program"
+	fi
+	;;
+      esac
+      # Quote arguments (to preserve shell metacharacters).
+      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
+      args="$args \"$file\""
+    done
+
+    if test -z "$run"; then
+      if test -n "$shlibpath_var"; then
+	# Export the shlibpath_var.
+	eval "export $shlibpath_var"
+      fi
+
+      # Restore saved enviroment variables
+      if test "${save_LC_ALL+set}" = set; then
+	LC_ALL="$save_LC_ALL"; export LC_ALL
+      fi
+      if test "${save_LANG+set}" = set; then
+	LANG="$save_LANG"; export LANG
+      fi
+
+      # Now prepare to actually exec the command.
+      exec_cmd="\$cmd$args"
+    else
+      # Display what would be done.
+      if test -n "$shlibpath_var"; then
+	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+	$echo "export $shlibpath_var"
+      fi
+      $echo "$cmd$args"
+      exit 0
+    fi
+    ;;
+
+  # libtool clean and uninstall mode
+  clean | uninstall)
+    modename="$modename: $mode"
+    rm="$nonopt"
+    files=
+    rmforce=
+    exit_status=0
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    for arg
+    do
+      case $arg in
+      -f) rm="$rm $arg"; rmforce=yes ;;
+      -*) rm="$rm $arg" ;;
+      *) files="$files $arg" ;;
+      esac
+    done
+
+    if test -z "$rm"; then
+      $echo "$modename: you must specify an RM program" 1>&2
+      $echo "$help" 1>&2
+      exit 1
+    fi
+
+    rmdirs=
+
+    for file in $files; do
+      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+      if test "X$dir" = "X$file"; then
+	dir=.
+	objdir="$objdir"
+      else
+	objdir="$dir/$objdir"
+      fi
+      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+      test $mode = uninstall && objdir="$dir"
+
+      # Remember objdir for removal later, being careful to avoid duplicates
+      if test $mode = clean; then
+	case " $rmdirs " in
+	  *" $objdir "*) ;;
+	  *) rmdirs="$rmdirs $objdir" ;;
+	esac
+      fi
+
+      # Don't error if the file doesn't exist and rm -f was used.
+      if (test -L "$file") >/dev/null 2>&1 \
+	|| (test -h "$file") >/dev/null 2>&1 \
+	|| test -f "$file"; then
+	:
+      elif test -d "$file"; then
+	exit_status=1
+	continue
+      elif test "$rmforce" = yes; then
+	continue
+      fi
+
+      rmfiles="$file"
+
+      case $name in
+      *.la)
+	# Possibly a libtool archive, so verify it.
+	if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	  . $dir/$name
+
+	  # Delete the libtool libraries and symlinks.
+	  for n in $library_names; do
+	    rmfiles="$rmfiles $objdir/$n"
+	  done
+	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+	  test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+
+	  if test $mode = uninstall; then
+	    if test -n "$library_names"; then
+	      # Do each command in the postuninstall commands.
+	      eval cmds=\"$postuninstall_cmds\"
+	      save_ifs="$IFS"; IFS='~'
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		$show "$cmd"
+		$run eval "$cmd"
+		if test $? != 0 && test "$rmforce" != yes; then
+		  exit_status=1
+		fi
+	      done
+	      IFS="$save_ifs"
+	    fi
+
+	    if test -n "$old_library"; then
+	      # Do each command in the old_postuninstall commands.
+	      eval cmds=\"$old_postuninstall_cmds\"
+	      save_ifs="$IFS"; IFS='~'
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		$show "$cmd"
+		$run eval "$cmd"
+		if test $? != 0 && test "$rmforce" != yes; then
+		  exit_status=1
+		fi
+	      done
+	      IFS="$save_ifs"
+	    fi
+	    # FIXME: should reinstall the best remaining shared library.
+	  fi
+	fi
+	;;
+
+      *.lo)
+	if test "$build_old_libs" = yes; then
+	  oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
+	  rmfiles="$rmfiles $dir/$oldobj"
+	fi
+	;;
+
+      *)
+	# Do a test to see if this is a libtool program.
+	if test $mode = clean &&
+	   (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	  relink_command=
+	  . $dir/$file
+
+	  rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+	  if test "$fast_install" = yes && test -n "$relink_command"; then
+	    rmfiles="$rmfiles $objdir/lt-$name"
+	  fi
+	fi
+	;;
+      esac
+      $show "$rm $rmfiles"
+      $run $rm $rmfiles || exit_status=1
+    done
+
+    # Try to remove the ${objdir}s in the directories where we deleted files
+    for dir in $rmdirs; do
+      if test -d "$dir"; then
+	$show "rmdir $dir"
+	$run rmdir $dir >/dev/null 2>&1
+      fi
+    done
+
+    exit $exit_status
+    ;;
+
+  "")
+    $echo "$modename: you must specify a MODE" 1>&2
+    $echo "$generic_help" 1>&2
+    exit 1
+    ;;
+  esac
+
+  if test -z "$exec_cmd"; then
+    $echo "$modename: invalid operation mode \`$mode'" 1>&2
+    $echo "$generic_help" 1>&2
+    exit 1
+  fi
+fi # test -z "$show_help"
+
+if test -n "$exec_cmd"; then
+  eval exec $exec_cmd
+  exit 1
+fi
+
+# We need to display help for each of the modes.
+case $mode in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+    --config          show all configuration variables
+    --debug           enable verbose shell tracing
+-n, --dry-run         display commands without modifying any files
+    --features        display basic configuration information and exit
+    --finish          same as \`--mode=finish'
+    --help            display this help message and exit
+    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
+    --quiet           same as \`--silent'
+    --silent          don't print informational messages
+    --version         print version information
+
+MODE must be one of the following:
+
+      clean           remove files from the build directory
+      compile         compile a source file into a libtool object
+      execute         automatically set library path, then run a program
+      finish          complete the installation of libtool libraries
+      install         install libraries or executables
+      link            create a library or an executable
+      uninstall       remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE."
+  exit 0
+  ;;
+
+clean)
+  $echo \
+"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+  ;;
+
+compile)
+  $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
+  -prefer-pic       try to building PIC objects only
+  -prefer-non-pic   try to building non-PIC objects only
+  -static           always build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+  ;;
+
+execute)
+  $echo \
+"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+  -dlopen FILE      add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+  ;;
+
+finish)
+  $echo \
+"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges.  Use
+the \`--dry-run' option if you just want to see what would be executed."
+  ;;
+
+install)
+  $echo \
+"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command.  The first component should be
+either the \`install' or \`cp' program.
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+  ;;
+
+link)
+  $echo \
+"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+  -all-static       do not do any dynamic linking at all
+  -avoid-version    do not add a version suffix if possible
+  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
+  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
+  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+  -export-symbols SYMFILE
+		    try to export only the symbols listed in SYMFILE
+  -export-symbols-regex REGEX
+		    try to export only the symbols matching REGEX
+  -LLIBDIR          search LIBDIR for required installed libraries
+  -lNAME            OUTPUT-FILE requires the installed library libNAME
+  -module           build a library that can dlopened
+  -no-fast-install  disable the fast-install mode
+  -no-install       link a not-installable executable
+  -no-undefined     declare that a library does not refer to external symbols
+  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
+  -release RELEASE  specify package release information
+  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
+  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
+  -static           do not do any dynamic linking of libtool libraries
+  -version-info CURRENT[:REVISION[:AGE]]
+		    specify library version info [each variable defaults to 0]
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename.  Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+  ;;
+
+uninstall)
+  $echo \
+"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+  ;;
+
+*)
+  $echo "$modename: invalid operation mode \`$mode'" 1>&2
+  $echo "$help" 1>&2
+  exit 1
+  ;;
+esac
+
+echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit 0
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
--- metamail-2.7.orig/config/install-sh
+++ metamail-2.7/config/install-sh
@@ -0,0 +1,251 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission.  M.I.T. makes no representations about the
+# suitability of this software for any purpose.  It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+    case $1 in
+	-c) instcmd="$cpprog"
+	    shift
+	    continue;;
+
+	-d) dir_arg=true
+	    shift
+	    continue;;
+
+	-m) chmodcmd="$chmodprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-o) chowncmd="$chownprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-g) chgrpcmd="$chgrpprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-s) stripcmd="$stripprog"
+	    shift
+	    continue;;
+
+	-t=*) transformarg=`echo $1 | sed 's/-t=//'`
+	    shift
+	    continue;;
+
+	-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+	    shift
+	    continue;;
+
+	*)  if [ x"$src" = x ]
+	    then
+		src=$1
+	    else
+		# this colon is to work around a 386BSD /bin/sh bug
+		:
+		dst=$1
+	    fi
+	    shift
+	    continue;;
+    esac
+done
+
+if [ x"$src" = x ]
+then
+	echo "install:	no input file specified"
+	exit 1
+else
+	true
+fi
+
+if [ x"$dir_arg" != x ]; then
+	dst=$src
+	src=""
+	
+	if [ -d $dst ]; then
+		instcmd=:
+		chmodcmd=""
+	else
+		instcmd=mkdir
+	fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad 
+# if $src (and thus $dsttmp) contains '*'.
+
+	if [ -f $src -o -d $src ]
+	then
+		true
+	else
+		echo "install:  $src does not exist"
+		exit 1
+	fi
+	
+	if [ x"$dst" = x ]
+	then
+		echo "install:	no destination specified"
+		exit 1
+	else
+		true
+	fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+	if [ -d $dst ]
+	then
+		dst="$dst"/`basename $src`
+	else
+		true
+	fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+#  this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='	
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+	pathcomp="${pathcomp}${1}"
+	shift
+
+	if [ ! -d "${pathcomp}" ] ;
+        then
+		$mkdirprog "${pathcomp}"
+	else
+		true
+	fi
+
+	pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+	$doit $instcmd $dst &&
+
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+	if [ x"$transformarg" = x ] 
+	then
+		dstfile=`basename $dst`
+	else
+		dstfile=`basename $dst $transformbasename | 
+			sed $transformarg`$transformbasename
+	fi
+
+# don't allow the sed command to completely eliminate the filename
+
+	if [ x"$dstfile" = x ] 
+	then
+		dstfile=`basename $dst`
+	else
+		true
+	fi
+
+# Make a temp file name in the proper directory.
+
+	dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+	$doit $instcmd $src $dsttmp &&
+
+	trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing.  If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+	$doit $rmcmd -f $dstdir/$dstfile &&
+	$doit $mvcmd $dsttmp $dstdir/$dstfile 
+
+fi &&
+
+
+exit 0
--- metamail-2.7.orig/config/missing
+++ metamail-2.7/config/missing
@@ -0,0 +1,190 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+case "$1" in
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+
+Supported PROGRAM values:
+  aclocal      touch file \`aclocal.m4'
+  autoconf     touch file \`configure'
+  autoheader   touch file \`config.h.in'
+  automake     touch all \`Makefile.in' files
+  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
+  flex         create \`lex.yy.c', if possible, from existing .c
+  lex          create \`lex.yy.c', if possible, from existing .c
+  makeinfo     touch the output file
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing - GNU libit 0.0"
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+  aclocal)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`acinclude.m4' or \`configure.in'.  You might want
+         to install the \`Automake' and \`Perl' packages.  Grab them from
+         any GNU archive site."
+    touch aclocal.m4
+    ;;
+
+  autoconf)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`configure.in'.  You might want to install the
+         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+         archive site."
+    touch configure
+    ;;
+
+  autoheader)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`acconfig.h' or \`configure.in'.  You might want
+         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+         from any GNU archive site."
+    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in`
+    test -z "$files" && files="config.h"
+    touch_files=
+    for f in $files; do
+      case "$f" in
+      *:*) touch_files="$touch_files "`echo "$f" |
+				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+      *) touch_files="$touch_files $f.in";;
+      esac
+    done
+    touch $touch_files
+    ;;
+
+  automake)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
+         You might want to install the \`Automake' and \`Perl' packages.
+         Grab them from any GNU archive site."
+    find . -type f -name Makefile.am -print |
+	   sed 's/\.am$/.in/' |
+	   while read f; do touch "$f"; done
+    ;;
+
+  bison|yacc)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.y' file.  You may need the \`Bison' package
+         in order for those modifications to take effect.  You can get
+         \`Bison' from any GNU archive site."
+    rm -f y.tab.c y.tab.h
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+	case "$LASTARG" in
+	*.y)
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" y.tab.c
+	    fi
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" y.tab.h
+	    fi
+	  ;;
+	esac
+    fi
+    if [ ! -f y.tab.h ]; then
+	echo >y.tab.h
+    fi
+    if [ ! -f y.tab.c ]; then
+	echo 'main() { return 0; }' >y.tab.c
+    fi
+    ;;
+
+  lex|flex)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.l' file.  You may need the \`Flex' package
+         in order for those modifications to take effect.  You can get
+         \`Flex' from any GNU archive site."
+    rm -f lex.yy.c
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+	case "$LASTARG" in
+	*.l)
+	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" lex.yy.c
+	    fi
+	  ;;
+	esac
+    fi
+    if [ ! -f lex.yy.c ]; then
+	echo 'main() { return 0; }' >lex.yy.c
+    fi
+    ;;
+
+  makeinfo)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.texi' or \`.texinfo' file, or any other file
+         indirectly affecting the aspect of the manual.  The spurious
+         call might also be the consequence of using a buggy \`make' (AIX,
+         DU, IRIX).  You might want to install the \`Texinfo' package or
+         the \`GNU make' package.  Grab either from any GNU archive site."
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
+    fi
+    touch $file
+    ;;
+
+  *)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+         system.  You might have modified some files without having the
+         proper tools for further handling them.  Check the \`README' file,
+         it often tells you about the needed prerequirements for installing
+         this package.  You may also peek at any GNU archive site, in case
+         some other package would contain this missing \`$1' program."
+    exit 1
+    ;;
+esac
+
+exit 0
--- metamail-2.7.orig/config/ltconfig
+++ metamail-2.7/config/ltconfig
@@ -0,0 +1,3115 @@
+#! /bin/sh
+
+# ltconfig - Create a system-specific libtool.
+# Copyright (C) 1996-1999 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A lot of this script is taken from autoconf-2.10.
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+echo=echo
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec "$SHELL" "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit 0
+fi
+
+# Find the correct PATH separator.  Usually this is `:', but
+# DJGPP uses `;' like DOS.
+if test "X${PATH_SEPARATOR+set}" != Xset; then
+  UNAME=${UNAME-`uname 2>/dev/null`}
+  case X$UNAME in
+    *-DOS) PATH_SEPARATOR=';' ;;
+    *)     PATH_SEPARATOR=':' ;;
+  esac
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+if test "X${echo_test_string+set}" != Xset; then
+  # find a string as large as possible, as long as the shell can cope with it
+  for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+    if (echo_test_string="`eval $cmd`") 2>/dev/null &&
+       echo_test_string="`eval $cmd`" &&
+       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then
+      break
+    fi
+  done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" != 'X\t' ||
+   test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then
+  # The Solaris, AIX, and Digital Unix default echo programs unquote
+  # backslashes.  This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  #
+  # So, first we look for a working echo in the user's PATH.
+
+  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+  for dir in $PATH /usr/ucb; do
+    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+       test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+      echo="$dir/echo"
+      break
+    fi
+  done
+  IFS="$save_ifs"
+
+  if test "X$echo" = Xecho; then
+    # We didn't find a better echo, so look for alternatives.
+    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+       test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+      # This shell has a builtin print -r that does the trick.
+      echo='print -r'
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+	 test "X$CONFIG_SHELL" != X/bin/ksh; then
+      # If we have ksh, try running ltconfig again with it.
+      ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}"
+      export ORIGINAL_CONFIG_SHELL
+      CONFIG_SHELL=/bin/ksh
+      export CONFIG_SHELL
+      exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"}
+    else
+      # Try using printf.
+      echo='printf "%s\n"'
+      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+	 test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+	# Cool, printf works
+	:
+      elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' &&
+	   test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+	CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL"
+	export CONFIG_SHELL
+	SHELL="$CONFIG_SHELL"
+	export SHELL
+	echo="$CONFIG_SHELL $0 --fallback-echo"
+      elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' &&
+	   test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+	echo="$CONFIG_SHELL $0 --fallback-echo"
+      else
+	# maybe with a smaller string...
+	prev=:
+
+	for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+	  if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then
+	    break
+	  fi
+	  prev="$cmd"
+	done
+
+	if test "$prev" != 'sed 50q "$0"'; then
+	  echo_test_string=`eval $prev`
+	  export echo_test_string
+	  exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"}
+	else
+	  # Oops.  We lost completely, so just stick with echo.
+	  echo=echo
+	fi
+      fi
+    fi
+  fi
+fi
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e s/^X//'
+sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# The name of this program.
+progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'`
+
+# Constants:
+PROGRAM=ltconfig
+PACKAGE=libtool
+VERSION=1.3.5
+TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)"
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+rm="rm -f"
+
+help="Try \`$progname --help' for more information."
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+enable_shared=yes
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+enable_static=yes
+enable_fast_install=yes
+enable_dlopen=unknown
+enable_win32_dll=no
+ltmain=
+silent=
+srcdir=
+ac_config_guess=
+ac_config_sub=
+host=
+nonopt=
+ofile="$default_ofile"
+verify_host=yes
+with_gcc=no
+with_gnu_ld=no
+need_locks=yes
+ac_ext=c
+objext=o
+libext=a
+exeext=
+cache_file=
+
+old_AR="$AR"
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+old_CPPFLAGS="$CPPFLAGS"
+old_LDFLAGS="$LDFLAGS"
+old_LD="$LD"
+old_LN_S="$LN_S"
+old_LIBS="$LIBS"
+old_NM="$NM"
+old_RANLIB="$RANLIB"
+old_DLLTOOL="$DLLTOOL"
+old_OBJDUMP="$OBJDUMP"
+old_AS="$AS"
+
+# Parse the command line options.
+args=
+prev=
+for option
+do
+  case "$option" in
+  -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) optarg= ;;
+  esac
+
+  # If the previous option needs an argument, assign it.
+  if test -n "$prev"; then
+    eval "$prev=\$option"
+    prev=
+    continue
+  fi
+
+  case "$option" in
+  --help) cat <<EOM
+Usage: $progname [OPTION]... [HOST [LTMAIN]]
+
+Generate a system-specific libtool script.
+
+    --debug                enable verbose shell tracing
+    --disable-shared       do not build shared libraries
+    --disable-static       do not build static libraries
+    --disable-fast-install do not optimize for fast installation
+    --enable-dlopen        enable dlopen support
+    --enable-win32-dll     enable building dlls on win32 hosts
+    --help                 display this help and exit
+    --no-verify            do not verify that HOST is a valid host type
+-o, --output=FILE          specify the output file [default=$default_ofile]
+    --quiet                same as \`--silent'
+    --silent               do not print informational messages
+    --srcdir=DIR           find \`config.guess' in DIR
+    --version              output version information and exit
+    --with-gcc             assume that the GNU C compiler will be used
+    --with-gnu-ld          assume that the C compiler uses the GNU linker
+    --disable-lock         disable file locking
+    --cache-file=FILE      configure cache file
+
+LTMAIN is the \`ltmain.sh' shell script fragment or \`ltmain.c' program
+that provides basic libtool functionality.
+
+HOST is the canonical host system name [default=guessed].
+EOM
+  exit 0
+  ;;
+
+  --debug)
+    echo "$progname: enabling shell trace mode"
+    set -x
+    ;;
+
+  --disable-shared) enable_shared=no ;;
+
+  --disable-static) enable_static=no ;;
+
+  --disable-fast-install) enable_fast_install=no ;;
+
+  --enable-dlopen) enable_dlopen=yes ;;
+
+  --enable-win32-dll) enable_win32_dll=yes ;;
+
+  --quiet | --silent) silent=yes ;;
+
+  --srcdir) prev=srcdir ;;
+  --srcdir=*) srcdir="$optarg" ;;
+
+  --no-verify) verify_host=no ;;
+
+  --output | -o) prev=ofile ;;
+  --output=*) ofile="$optarg" ;;
+
+  --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"; exit 0 ;;
+
+  --with-gcc) with_gcc=yes ;;
+  --with-gnu-ld) with_gnu_ld=yes ;;
+
+  --disable-lock) need_locks=no ;;
+
+  --cache-file=*) cache_file="$optarg" ;;
+
+  -*)
+    echo "$progname: unrecognized option \`$option'" 1>&2
+    echo "$help" 1>&2
+    exit 1
+    ;;
+
+  *)
+    if test -z "$ltmain"; then
+      ltmain="$option"
+    elif test -z "$host"; then
+# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1
+#      if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then
+#        echo "$progname: warning \`$option' is not a valid host type" 1>&2
+#      fi
+      host="$option"
+    else
+      echo "$progname: too many arguments" 1>&2
+      echo "$help" 1>&2
+      exit 1
+    fi ;;
+  esac
+done
+
+if test -z "$ltmain"; then
+  echo "$progname: you must specify a LTMAIN file" 1>&2
+  echo "$help" 1>&2
+  exit 1
+fi
+
+if test ! -f "$ltmain"; then
+  echo "$progname: \`$ltmain' does not exist" 1>&2
+  echo "$help" 1>&2
+  exit 1
+fi
+
+# Quote any args containing shell metacharacters.
+ltconfig_args=
+for arg
+do
+  case "$arg" in
+  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+  ltconfig_args="$ltconfig_args '$arg'" ;;
+  *) ltconfig_args="$ltconfig_args $arg" ;;
+  esac
+done
+
+# A relevant subset of AC_INIT.
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 5 compiler messages saved in config.log
+# 6 checking for... messages and results
+if test "$silent" = yes; then
+  exec 6>/dev/null
+else
+  exec 6>&1
+fi
+exec 5>>./config.log
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+if test "X${LC_ALL+set}" = Xset; then LC_ALL=C; export LC_ALL; fi
+if test "X${LANG+set}"   = Xset; then LANG=C;   export LANG;   fi
+
+if test -n "$cache_file" && test -r "$cache_file"; then
+  echo "loading cache $cache_file within ltconfig"
+  . $cache_file
+fi
+
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+    ac_n= ac_c='
+' ac_t='	'
+  else
+    ac_n=-n ac_c= ac_t=
+  fi
+else
+  ac_n= ac_c='\c' ac_t=
+fi
+
+if test -z "$srcdir"; then
+  # Assume the source directory is the same one as the path to LTMAIN.
+  srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'`
+  test "$srcdir" = "$ltmain" && srcdir=.
+fi
+
+trap "$rm conftest*; exit 1" 1 2 15
+if test "$verify_host" = yes; then
+  # Check for config.guess and config.sub.
+  ac_aux_dir=
+  for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+    if test -f $ac_dir/config.guess; then
+      ac_aux_dir=$ac_dir
+      break
+    fi
+  done
+  if test -z "$ac_aux_dir"; then
+    echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2
+    echo "$help" 1>&2
+    exit 1
+  fi
+  ac_config_guess=$ac_aux_dir/config.guess
+  ac_config_sub=$ac_aux_dir/config.sub
+
+  # Make sure we can run config.sub.
+  if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then :
+  else
+    echo "$progname: cannot run $ac_config_sub" 1>&2
+    echo "$help" 1>&2
+    exit 1
+  fi
+
+  echo $ac_n "checking host system type""... $ac_c" 1>&6
+
+  host_alias=$host
+  case "$host_alias" in
+  "")
+    if host_alias=`$SHELL $ac_config_guess`; then :
+    else
+      echo "$progname: cannot guess host type; you must specify one" 1>&2
+      echo "$help" 1>&2
+      exit 1
+    fi ;;
+  esac
+  host=`$SHELL $ac_config_sub $host_alias`
+  echo "$ac_t$host" 1>&6
+
+  # Make sure the host verified.
+  test -z "$host" && exit 1
+
+elif test -z "$host"; then
+  echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2
+  echo "$help" 1>&2
+  exit 1
+else
+  host_alias=$host
+fi
+
+# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+case "$host_os" in
+linux-gnu*) ;;
+linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+esac
+
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+case "$host_os" in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR cru $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+# Set a sane default for `AR'.
+test -z "$AR" && AR=ar
+
+# Set a sane default for `OBJDUMP'.
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+# If RANLIB is not set, then run the test.
+if test "${RANLIB+set}" != "set"; then
+  result=no
+
+  echo $ac_n "checking for ranlib... $ac_c" 1>&6
+  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then
+      RANLIB="ranlib"
+      result="ranlib"
+      break
+    fi
+  done
+  IFS="$save_ifs"
+
+  echo "$ac_t$result" 1>&6
+fi
+
+if test -n "$RANLIB"; then
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+  old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
+fi
+
+# Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin.
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$AS" && AS=as
+
+# Check to see if we are using GCC.
+if test "$with_gcc" != yes || test -z "$CC"; then
+  # If CC is not set, then try to find GCC or a usable CC.
+  if test -z "$CC"; then
+    echo $ac_n "checking for gcc... $ac_c" 1>&6
+    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+    for dir in $PATH; do
+      test -z "$dir" && dir=.
+      if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then
+	CC="gcc"
+	break
+      fi
+    done
+    IFS="$save_ifs"
+
+    if test -n "$CC"; then
+      echo "$ac_t$CC" 1>&6
+    else
+      echo "$ac_t"no 1>&6
+    fi
+  fi
+
+  # Not "gcc", so try "cc", rejecting "/usr/ucb/cc".
+  if test -z "$CC"; then
+    echo $ac_n "checking for cc... $ac_c" 1>&6
+    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+    cc_rejected=no
+    for dir in $PATH; do
+      test -z "$dir" && dir=.
+      if test -f $dir/cc || test -f $dir/cc$ac_exeext; then
+	if test "$dir/cc" = "/usr/ucb/cc"; then
+	  cc_rejected=yes
+	  continue
+	fi
+	CC="cc"
+	break
+      fi
+    done
+    IFS="$save_ifs"
+    if test $cc_rejected = yes; then
+      # We found a bogon in the path, so make sure we never use it.
+      set dummy $CC
+      shift
+      if test $# -gt 0; then
+	# We chose a different compiler from the bogus one.
+	# However, it has the same name, so the bogon will be chosen
+	# first if we set CC to just the name; use the full file name.
+	shift
+	set dummy "$dir/cc" "$@"
+	shift
+	CC="$@"
+      fi
+    fi
+
+    if test -n "$CC"; then
+      echo "$ac_t$CC" 1>&6
+    else
+      echo "$ac_t"no 1>&6
+    fi
+
+    if test -z "$CC"; then
+      echo "$progname: error: no acceptable cc found in \$PATH" 1>&2
+      exit 1
+    fi
+  fi
+
+  # Now see if the compiler is really GCC.
+  with_gcc=no
+  echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6
+  echo "$progname:581: checking whether we are using GNU C" >&5
+
+  $rm conftest.c
+  cat > conftest.c <<EOF
+#ifdef __GNUC__
+  yes;
+#endif
+EOF
+  if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:589: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+    with_gcc=yes
+  fi
+  $rm conftest.c
+  echo "$ac_t$with_gcc" 1>&6
+fi
+
+# Allow CC to be a program name with arguments.
+set dummy $CC
+compiler="$2"
+
+echo $ac_n "checking for object suffix... $ac_c" 1>&6
+$rm conftest*
+echo 'int i = 1;' > conftest.c
+echo "$progname:603: checking for object suffix" >& 5
+if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then
+  # Append any warnings to the config.log.
+  cat conftest.err 1>&5
+
+  for ac_file in conftest.*; do
+    case $ac_file in
+    *.c) ;;
+    *) objext=`echo $ac_file | sed -e s/conftest.//` ;;
+    esac
+  done
+else
+  cat conftest.err 1>&5
+  echo "$progname: failed program was:" >&5
+  cat conftest.c >&5
+fi
+$rm conftest*
+echo "$ac_t$objext" 1>&6
+
+echo $ac_n "checking for executable suffix... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_exeext="no"
+  $rm conftest*
+  echo 'main () { return 0; }' > conftest.c
+  echo "$progname:629: checking for executable suffix" >& 5
+  if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then
+    # Append any warnings to the config.log.
+    cat conftest.err 1>&5
+
+    for ac_file in conftest.*; do
+      case $ac_file in
+      *.c | *.err | *.$objext ) ;;
+      *) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;;
+      esac
+    done
+  else
+    cat conftest.err 1>&5
+    echo "$progname: failed program was:" >&5
+    cat conftest.c >&5
+  fi
+  $rm conftest*
+fi
+if test "X$ac_cv_exeext" = Xno; then
+  exeext=""
+else
+  exeext="$ac_cv_exeext"
+fi
+echo "$ac_t$ac_cv_exeext" 1>&6
+
+echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6
+pic_flag=
+special_shlib_compile_flags=
+wl=
+link_static_flag=
+no_builtin_flag=
+
+if test "$with_gcc" = yes; then
+  wl='-Wl,'
+  link_static_flag='-static'
+
+  case "$host_os" in
+  beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
+    # PIC is the default for these OSes.
+    ;;
+  aix*)
+    # Below there is a dirty hack to force normal static linking with -ldl
+    # The problem is because libdl dynamically linked with both libc and
+    # libC (AIX C++ library), which obviously doesn't included in libraries
+    # list by gcc. This cause undefined symbols with -static flags.
+    # This hack allows C programs to be linked with "-static -ldl", but
+    # we not sure about C++ programs.
+    link_static_flag="$link_static_flag ${wl}-lC"
+    ;;
+  cygwin* | mingw* | os2*)
+    # We can build DLLs from non-PIC.
+    ;;
+  amigaos*)
+    # FIXME: we need at least 68020 code to build shared libraries, but
+    # adding the `-m68020' flag to GCC prevents building anything better,
+    # like `-m68040'.
+    pic_flag='-m68020 -resident32 -malways-restore-a4'
+    ;;
+  sysv4*MP*)
+    if test -d /usr/nec; then
+       pic_flag=-Kconform_pic
+    fi
+    ;;
+  *)
+    pic_flag='-fPIC'
+    ;;
+  esac
+else
+  # PORTME Check for PIC flags for the system compiler.
+  case "$host_os" in
+  aix3* | aix4*)
+    # All AIX code is PIC.
+    link_static_flag='-bnso -bI:/lib/syscalls.exp'
+    ;;
+
+  hpux9* | hpux10* | hpux11*)
+    # Is there a better link_static_flag that works with the bundled CC?
+    wl='-Wl,'
+    link_static_flag="${wl}-a ${wl}archive"
+    pic_flag='+Z'
+    ;;
+
+  irix5* | irix6*)
+    wl='-Wl,'
+    link_static_flag='-non_shared'
+    # PIC (with -KPIC) is the default.
+    ;;
+
+  cygwin* | mingw* | os2*)
+    # We can build DLLs from non-PIC.
+    ;;
+
+  osf3* | osf4* | osf5*)
+    # All OSF/1 code is PIC.
+    wl='-Wl,'
+    link_static_flag='-non_shared'
+    ;;
+
+  sco3.2v5*)
+    pic_flag='-Kpic'
+    link_static_flag='-dn'
+    special_shlib_compile_flags='-belf'
+    ;;
+
+  solaris*)
+    pic_flag='-KPIC'
+    link_static_flag='-Bstatic'
+    wl='-Wl,'
+    ;;
+
+  sunos4*)
+    pic_flag='-PIC'
+    link_static_flag='-Bstatic'
+    wl='-Qoption ld '
+    ;;
+
+  sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+    pic_flag='-KPIC'
+    link_static_flag='-Bstatic'
+    wl='-Wl,'
+    ;;
+
+  uts4*)
+    pic_flag='-pic'
+    link_static_flag='-Bstatic'
+    ;;
+  sysv4*MP*)
+    if test -d /usr/nec ;then
+      pic_flag='-Kconform_pic'
+      link_static_flag='-Bstatic'
+    fi
+    ;;
+  *)
+    can_build_shared=no
+    ;;
+  esac
+fi
+
+if test -n "$pic_flag"; then
+  echo "$ac_t$pic_flag" 1>&6
+
+  # Check to make sure the pic_flag actually works.
+  echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6
+  $rm conftest*
+  echo "int some_variable = 0;" > conftest.c
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS $pic_flag -DPIC"
+  echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5
+  if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then
+    # Append any warnings to the config.log.
+    cat conftest.err 1>&5
+    
+    case "$host_os" in
+    hpux9* | hpux10* | hpux11*)
+      # On HP-UX, both CC and GCC only warn that PIC is supported... then they
+      # create non-PIC objects.  So, if there were any warnings, we assume that
+      # PIC is not supported.
+      if test -s conftest.err; then
+	echo "$ac_t"no 1>&6
+	can_build_shared=no
+	pic_flag=
+      else
+	echo "$ac_t"yes 1>&6
+	pic_flag=" $pic_flag"
+      fi
+      ;;
+    *)
+      echo "$ac_t"yes 1>&6
+      pic_flag=" $pic_flag"
+      ;;
+    esac
+  else
+    # Append any errors to the config.log.
+    cat conftest.err 1>&5
+    can_build_shared=no
+    pic_flag=
+    echo "$ac_t"no 1>&6
+  fi
+  CFLAGS="$save_CFLAGS"
+  $rm conftest*
+else
+  echo "$ac_t"none 1>&6
+fi
+
+# Check to see if options -o and -c are simultaneously supported by compiler
+echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6
+$rm -r conftest 2>/dev/null
+mkdir conftest
+cd conftest
+$rm conftest*
+echo "int some_variable = 0;" > conftest.c
+mkdir out
+# According to Tom Tromey, Ian Lance Taylor reported there are C compilers
+# that will create temporary files in the current directory regardless of
+# the output directory.  Thus, making CWD read-only will cause this test
+# to fail, enabling locking or at least warning the user not to do parallel
+# builds.
+chmod -w .
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -o out/conftest2.o"
+echo "$progname:829: checking if $compiler supports -c -o file.o" >&5
+if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then
+
+  # The compiler can only warn and ignore the option if not recognized
+  # So say no if there are warnings
+    if test -s out/conftest.err; then
+      echo "$ac_t"no 1>&6
+      compiler_c_o=no
+    else
+      echo "$ac_t"yes 1>&6
+      compiler_c_o=yes
+    fi
+else
+  # Append any errors to the config.log.
+  cat out/conftest.err 1>&5
+  compiler_c_o=no
+  echo "$ac_t"no 1>&6
+fi
+CFLAGS="$save_CFLAGS"
+chmod u+w .
+$rm conftest* out/*
+rmdir out
+cd ..
+rmdir conftest
+$rm -r conftest 2>/dev/null
+
+if test x"$compiler_c_o" = x"yes"; then
+  # Check to see if we can write to a .lo
+  echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6
+  $rm conftest*
+  echo "int some_variable = 0;" > conftest.c
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -c -o conftest.lo"
+  echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5
+if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then
+
+    # The compiler can only warn and ignore the option if not recognized
+    # So say no if there are warnings
+      if test -s conftest.err; then
+	echo "$ac_t"no 1>&6
+	compiler_o_lo=no
+      else
+	echo "$ac_t"yes 1>&6
+	compiler_o_lo=yes
+      fi
+  else
+    # Append any errors to the config.log.
+    cat conftest.err 1>&5
+    compiler_o_lo=no
+    echo "$ac_t"no 1>&6
+  fi
+  CFLAGS="$save_CFLAGS"
+  $rm conftest*
+else
+  compiler_o_lo=no
+fi
+
+# Check to see if we can do hard links to lock some files if needed
+hard_links="nottested"
+if test "$compiler_c_o" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  echo "$ac_t$hard_links" 1>&6
+  $rm conftest*
+  if test "$hard_links" = no; then
+    echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+if test "$with_gcc" = yes; then
+  # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
+  echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6
+  $rm conftest*
+  echo "int some_variable = 0;" > conftest.c
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c"
+  echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+  if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then
+
+    # The compiler can only warn and ignore the option if not recognized
+    # So say no if there are warnings
+      if test -s conftest.err; then
+	echo "$ac_t"no 1>&6
+	compiler_rtti_exceptions=no
+      else
+	echo "$ac_t"yes 1>&6
+	compiler_rtti_exceptions=yes
+      fi
+  else
+    # Append any errors to the config.log.
+    cat conftest.err 1>&5
+    compiler_rtti_exceptions=no
+    echo "$ac_t"no 1>&6
+  fi
+  CFLAGS="$save_CFLAGS"
+  $rm conftest*
+
+  if test "$compiler_rtti_exceptions" = "yes"; then
+    no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
+  else
+    no_builtin_flag=' -fno-builtin'
+  fi
+  
+fi
+
+# Check for any special shared library compilation flags.
+if test -n "$special_shlib_compile_flags"; then
+  echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2
+  if echo "$old_CC $old_CFLAGS " | egrep -e "[ 	]$special_shlib_compile_flags[ 	]" >/dev/null; then :
+  else
+    echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2
+    can_build_shared=no
+  fi
+fi
+
+echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6
+$rm conftest*
+echo 'main(){return(0);}' > conftest.c
+save_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS $link_static_flag"
+echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5
+if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  echo "$ac_t$link_static_flag" 1>&6
+else
+  echo "$ac_t"none 1>&6
+  link_static_flag=
+fi
+LDFLAGS="$save_LDFLAGS"
+$rm conftest*
+
+if test -z "$LN_S"; then
+  # Check to see if we can use ln -s, or we need hard links.
+  echo $ac_n "checking whether ln -s works... $ac_c" 1>&6
+  $rm conftest.dat
+  if ln -s X conftest.dat 2>/dev/null; then
+    $rm conftest.dat
+    LN_S="ln -s"
+  else
+    LN_S=ln
+  fi
+  if test "$LN_S" = "ln -s"; then
+    echo "$ac_t"yes 1>&6
+  else
+    echo "$ac_t"no 1>&6
+  fi
+fi
+
+# Make sure LD is an absolute path.
+if test -z "$LD"; then
+  ac_prog=ld
+  if test "$with_gcc" = yes; then
+    # Check if gcc -print-prog-name=ld gives a path.
+    echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6
+    echo "$progname:991: checking for ld used by GCC" >&5
+    ac_prog=`($CC -print-prog-name=ld) 2>&5`
+    case "$ac_prog" in
+    # Accept absolute paths.
+    [\\/]* | [A-Za-z]:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the path of ld
+      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+    "")
+      # If it fails, then pretend we are not using GCC.
+      ac_prog=ld
+      ;;
+    *)
+      # If it is relative, then search for the first ld in PATH.
+      with_gnu_ld=unknown
+      ;;
+    esac
+  elif test "$with_gnu_ld" = yes; then
+    echo $ac_n "checking for GNU ld... $ac_c" 1>&6
+    echo "$progname:1015: checking for GNU ld" >&5
+  else
+    echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
+    echo "$progname:1018: checking for non-GNU ld" >&5
+  fi
+
+  if test -z "$LD"; then
+    IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+    for ac_dir in $PATH; do
+      test -z "$ac_dir" && ac_dir=.
+      if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+	LD="$ac_dir/$ac_prog"
+	# Check to see if the program is GNU ld.  I'd rather use --version,
+	# but apparently some GNU ld's only accept -v.
+	# Break only if it was the GNU/non-GNU ld that we prefer.
+	if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+	  test "$with_gnu_ld" != no && break
+	else
+	  test "$with_gnu_ld" != yes && break
+	fi
+      fi
+    done
+    IFS="$ac_save_ifs"
+  fi
+
+  if test -n "$LD"; then
+    echo "$ac_t$LD" 1>&6
+  else
+    echo "$ac_t"no 1>&6
+  fi
+
+  if test -z "$LD"; then
+    echo "$progname: error: no acceptable ld found in \$PATH" 1>&2
+    exit 1
+  fi
+fi
+
+# Check to see if it really is or is not GNU ld.
+echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6
+# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+  with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+echo "$ac_t$with_gnu_ld" 1>&6
+
+# See if the linker supports building shared libraries.
+echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6
+
+allow_undefined_flag=
+no_undefined_flag=
+need_lib_prefix=unknown
+need_version=unknown
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+archive_cmds=
+archive_expsym_cmds=
+old_archive_from_new_cmds=
+export_dynamic_flag_spec=
+whole_archive_flag_spec=
+thread_safe_flag_spec=
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+hardcode_shlibpath_var=unsupported
+runpath_var=
+always_export_symbols=no
+export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
+# include_expsyms should be a list of space-separated symbols to be *always*
+# included in the symbol list
+include_expsyms=
+# exclude_expsyms can be an egrep regular expression of symbols to exclude
+# it will be wrapped by ` (' and `)$', so one must not match beginning or
+# end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+# as well as any symbol that contains `d'.
+exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+# platforms (ab)use it in PIC code, but their linkers get confused if
+# the symbol is explicitly referenced.  Since portable code cannot
+# rely on this symbol name, it's probably fine to never include it in
+# preloaded symbol tables.
+
+case "$host_os" in
+cygwin* | mingw*)
+  # FIXME: the MSVC++ port hasn't been tested in a loooong time
+  # When not using gcc, we currently assume that we are using
+  # Microsoft Visual C++.
+  if test "$with_gcc" != yes; then
+    with_gnu_ld=no
+  fi
+  ;;
+
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+  # If archive_cmds runs LD, not CC, wlarc should be empty
+  wlarc='${wl}'
+
+  # See if GNU ld supports shared libraries.
+  case "$host_os" in
+  aix3* | aix4*)
+    # On AIX, the GNU linker is very broken
+    ld_shlibs=no
+    cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+    ;;
+
+  amigaos*)
+    archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+
+    # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+    # that the semantics of dynamic libraries on AmigaOS, at least up
+    # to version 4, is to share data among multiple programs linked
+    # with the same dynamic library.  Since this doesn't match the
+    # behavior of shared libraries on other platforms, we can use
+    # them.
+    ld_shlibs=no
+    ;;
+
+  beos*)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      allow_undefined_flag=unsupported
+      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+      # support --undefined.  This deserves some investigation.  FIXME
+      archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
+  cygwin* | mingw*)
+    # hardcode_libdir_flag_spec is actually meaningless, as there is
+    # no search path for DLLs.
+    hardcode_libdir_flag_spec='-L$libdir'
+    allow_undefined_flag=unsupported
+    always_export_symbols=yes
+
+    # Extract the symbol export list from an `--export-all' def file,
+    # then regenerate the def file from the symbol export list, so that
+    # the compiled dll only exports the symbol export list.
+    # Be careful not to strip the DATA tag left by newer dlltools.
+    export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
+      test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~
+      $DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def  $objdir/$soname-ltdll.$objext $libobjs $convenience~
+      sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $objdir/$soname-def > $export_symbols'
+
+    # If DATA tags from a recent dlltool are present, honour them!
+    archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~
+      _lt_hint=1;
+      cat $export_symbols | while read symbol; do
+        set dummy \$symbol;
+        case \$# in
+          2) echo "	\$2 @ \$_lt_hint ; " >> $objdir/$soname-def;;
+          *) echo "     \$2 @ \$_lt_hint \$3 ; " >> $objdir/$soname-def;;
+        esac;
+	_lt_hint=`expr 1 + \$_lt_hint`;
+      done~
+      test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
+      test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~
+      $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
+      $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
+      $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts'
+
+      old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a' 
+    ;;
+
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    else
+      archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib'
+      # can we support soname and/or expsyms with a.out? -oliva
+    fi
+    ;;
+
+  solaris* | sysv5*)
+    if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
+      ld_shlibs=no
+      cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+    elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;      
+
+  sunos4*)
+    archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts'
+    wlarc=
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  *)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+  esac
+
+  if test "$ld_shlibs" = yes; then
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    case $host_os in
+    cygwin* | mingw*)
+      # dlltool doesn't understand --whole-archive et. al.
+      whole_archive_flag_spec=
+      ;;
+    *)
+      # ancient GNU ld didn't support --whole-archive et. al.
+      if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
+        whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+        whole_archive_flag_spec=
+      fi
+      ;;
+    esac
+  fi
+else
+  # PORTME fill in a description of your system's linker (not GNU ld)
+  case "$host_os" in
+  aix3*)
+    allow_undefined_flag=unsupported
+    always_export_symbols=yes
+    archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname'
+    # Note: this linker hardcodes the directories in LIBPATH if there
+    # are no directories specified by -L.
+    hardcode_minus_L=yes
+    if test "$with_gcc" = yes && test -z "$link_static_flag"; then
+      # Neither direct hardcoding nor static linking is supported with a
+      # broken collect2.
+      hardcode_direct=unsupported
+    fi
+    ;;
+
+  aix4*)
+    hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib'
+    hardcode_libdir_separator=':'
+    if test "$with_gcc" = yes; then
+      collect2name=`${CC} -print-prog-name=collect2`
+      if test -f "$collect2name" && \
+	 strings "$collect2name" | grep resolve_lib_name >/dev/null
+      then
+	# We have reworked collect2
+	hardcode_direct=yes
+      else
+	# We have old collect2
+	hardcode_direct=unsupported
+	# It fails to find uninstalled libraries when the uninstalled
+	# path is not listed in the libpath.  Setting hardcode_minus_L
+	# to unsupported forces relinking
+	hardcode_minus_L=yes
+	hardcode_libdir_flag_spec='-L$libdir'
+	hardcode_libdir_separator=
+      fi
+      shared_flag='-shared'
+    else
+      shared_flag='${wl}-bM:SRE'
+      hardcode_direct=yes
+    fi
+    allow_undefined_flag=' ${wl}-berok'
+    archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}'
+    archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}'
+    case "$host_os" in aix4.[01]|aix4.[01].*)
+      # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on
+      always_export_symbols=yes ;;
+    esac
+   ;;
+
+  amigaos*)
+    archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    # see comment about different semantics on the GNU ld section
+    ld_shlibs=no
+    ;;
+
+  cygwin* | mingw*)
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    # hardcode_libdir_flag_spec is actually meaningless, as there is
+    # no search path for DLLs.
+    hardcode_libdir_flag_spec=' '
+    allow_undefined_flag=unsupported
+    # Tell ltmain to make .lib files, not .a files.
+    libext=lib
+    # FIXME: Setting linknames here is a bad hack.
+    archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+    # The linker will automatically build a .lib file if we build a DLL.
+    old_archive_from_new_cmds='true'
+    # FIXME: Should let the user specify the lib program.
+    old_archive_cmds='lib /OUT:$oldlib$oldobjs'
+    fix_srcfile_path='`cygpath -w $srcfile`'
+    ;;
+
+  freebsd1*)
+    ld_shlibs=no
+    ;;
+
+  # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+  # support.  Future versions do this automatically, but an explicit c++rt0.o
+  # does not break anything, and helps significantly (at the cost of a little
+  # extra space).
+  freebsd2.2*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+  freebsd2*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+  freebsd*)
+    archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  hpux9* | hpux10* | hpux11*)
+    case "$host_os" in
+    hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;;
+    *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;;
+    esac
+    hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+    hardcode_libdir_separator=:
+    hardcode_direct=yes
+    hardcode_minus_L=yes # Not in the search PATH, but as the default
+			 # location of the library.
+    export_dynamic_flag_spec='${wl}-E'
+    ;;
+
+  irix5* | irix6*)
+    if test "$with_gcc" = yes; then
+      archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+    else
+      archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+    fi
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    ;;
+
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'  # a.out
+    else
+      archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts'      # ELF
+    fi
+    hardcode_libdir_flag_spec='${wl}-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  openbsd*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  os2*)
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    allow_undefined_flag=unsupported
+    archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def'
+    old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def'
+    ;;
+
+  osf3*)
+    if test "$with_gcc" = yes; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+    else
+      allow_undefined_flag=' -expect_unresolved \*'
+      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+    fi
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    ;;
+
+  osf4* | osf5*)  # As osf3* with the addition of the -msym flag
+    if test "$with_gcc" = yes; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+    else
+      allow_undefined_flag=' -expect_unresolved \*'
+      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+    fi
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    ;;
+  rhapsody*)
+    archive_cmds='$CC -bundle -undefined suppress -o $lib $libobjs $deplibs $linkopts'
+    hardcode_libdir_flags_spec='-L$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+                                       
+  sco3.2v5*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+    hardcode_shlibpath_var=no
+    runpath_var=LD_RUN_PATH
+    hardcode_runpath_var=yes
+    ;;
+
+  solaris*)
+    no_undefined_flag=' -z text'
+    # $CC -shared without GNU ld will not create a library from C++
+    # object files and a static libstdc++, better avoid it by now
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts'
+    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_shlibpath_var=no
+    case "$host_os" in
+    solaris2.[0-5] | solaris2.[0-5].*) ;;
+    *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+      whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+    esac
+    ;;
+
+  sunos4*)
+    archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4)
+    if test "x$host_vendor" = xsequent; then
+      # Use $CC to link under sequent, because it throws in some extra .o 
+      # files that make .init and .fini sections work.
+      archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $linkopts'
+    else
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+    fi
+    runpath_var='LD_RUN_PATH'
+    hardcode_shlibpath_var=no
+    hardcode_direct=no #Motorola manual says yes, but my tests say they lie 
+    ;;  
+
+  sysv4.3*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+    hardcode_shlibpath_var=no
+    export_dynamic_flag_spec='-Bexport'
+    ;;
+
+  sysv5*)
+    no_undefined_flag=' -z text'
+    # $CC -shared without GNU ld will not create a library from C++
+    # object files and a static libstdc++, better avoid it by now
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts'
+    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp'
+    hardcode_libdir_flag_spec=
+    hardcode_shlibpath_var=no
+    runpath_var='LD_RUN_PATH'
+    ;;
+
+  uts4*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_shlibpath_var=no
+    ;;
+
+  dgux*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4*MP*)
+    if test -d /usr/nec; then
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+      hardcode_shlibpath_var=no
+      runpath_var=LD_RUN_PATH
+      hardcode_runpath_var=yes
+      ld_shlibs=yes
+    fi
+    ;;
+
+  sysv4.2uw2*)
+    archive_cmds='$LD -G -o $lib $libobjs $deplibs $linkopts'
+    hardcode_direct=yes
+    hardcode_minus_L=no
+    hardcode_shlibpath_var=no
+    hardcode_runpath_var=yes
+    runpath_var=LD_RUN_PATH
+    ;;
+
+  unixware7*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+    runpath_var='LD_RUN_PATH'
+    hardcode_shlibpath_var=no
+    ;;
+
+  *)
+    ld_shlibs=no
+    ;;
+  esac
+fi
+echo "$ac_t$ld_shlibs" 1>&6
+test "$ld_shlibs" = no && can_build_shared=no
+
+if test -z "$NM"; then
+  echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6
+  case "$NM" in
+  [\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path.
+  *)
+    IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+    for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do
+      test -z "$ac_dir" && ac_dir=.
+      if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+	  NM="$ac_dir/nm -B"
+	  break
+	elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+	  NM="$ac_dir/nm -p"
+	  break
+	else
+	  NM=${NM="$ac_dir/nm"} # keep the first match, but
+	  continue # so that we can try to find one that supports BSD flags
+	fi
+      fi
+    done
+    IFS="$ac_save_ifs"
+    test -z "$NM" && NM=nm
+    ;;
+  esac
+  echo "$ac_t$NM" 1>&6
+fi
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Transform the above into a raw symbol and a C symbol.
+symxfrm='\1 \2\3 \3'
+
+# Transform an extracted symbol line into a proper C declaration
+global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
+
+# Define system-specific variables.
+case "$host_os" in
+aix*)
+  symcode='[BCDT]'
+  ;;
+cygwin* | mingw*)
+  symcode='[ABCDGISTW]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
+  ;;
+irix*)
+  symcode='[BCDEGRST]'
+  ;;
+solaris*)
+  symcode='[BDT]'
+  ;;
+sysv4)
+  symcode='[DFNSTU]'
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
+  symcode='[ABCDGISTW]'
+fi
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Write the raw and C identifiers.
+  global_symbol_pipe="sed -n -e 's/^.*[ 	]\($symcode\)[ 	][ 	]*\($ac_symprfx\)$sympat$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+  $rm conftest*
+  cat > conftest.c <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+  echo "$progname:1653: checking if global_symbol_pipe works" >&5
+  if { (eval echo $progname:1654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if { echo "$progname:1657: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then
+
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if egrep ' nm_test_var$' "$nlist" >/dev/null; then
+	if egrep ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<EOF > conftest.c
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+	  # Now generate the symbol file.
+	  eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c'
+
+	  cat <<EOF >> conftest.c
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr_t address;
+}
+lt_preloaded_symbols[] =
+{
+EOF
+	  sed 's/^. \(.*\) \(.*\)$/  {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c
+	  cat <<\EOF >> conftest.c
+  {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+	  # Now try linking the two files.
+	  mv conftest.$objext conftstm.$objext
+	  save_LIBS="$LIBS"
+	  save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$objext"
+	  CFLAGS="$CFLAGS$no_builtin_flag"
+	  if { (eval echo $progname:1709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+	    pipe_works=yes
+	  else
+	    echo "$progname: failed program was:" >&5
+	    cat conftest.c >&5
+	  fi
+	  LIBS="$save_LIBS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&5
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&5
+      fi
+    else
+      echo "cannot run $global_symbol_pipe" >&5
+    fi
+  else
+    echo "$progname: failed program was:" >&5
+    cat conftest.c >&5
+  fi
+  $rm conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    global_symbol_pipe=
+  fi
+done
+if test "$pipe_works" = yes; then
+  echo "${ac_t}ok" 1>&6
+else
+  echo "${ac_t}failed" 1>&6
+fi
+
+if test -z "$global_symbol_pipe"; then
+  global_symbol_to_cdecl=
+fi
+
+# Check hardcoding attributes.
+echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+   test -n "$runpath_var"; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$hardcode_shlibpath_var" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+echo "$ac_t$hardcode_action" 1>&6
+
+
+reload_flag=
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6
+# PORTME Some linkers may need a different reload flag.
+reload_flag='-r'
+echo "$ac_t$reload_flag" 1>&6
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+
+# PORTME Fill in your ld.so characteristics
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+file_magic_cmd=
+file_magic_test_file=
+deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [regex]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6
+case "$host_os" in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}.so$major'
+  ;;
+
+aix4*)
+  version_type=linux
+  # AIX has no versioning support, so currently we can not hardcode correct
+  # soname into executable. Probably we can add versioning support to
+  # collect2, so additional links can be useful in future.
+  # We preserve .a as extension for shared libraries though AIX4.2
+  # and later linker supports .so
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a'
+  shlibpath_var=LIBPATH
+  deplibs_check_method=pass_all
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}.so'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  deplibs_check_method=pass_all
+  lt_cv_dlopen="load_add_on"
+  lt_cv_dlopen_libs=
+  lt_cv_dlopen_self=yes
+  ;;
+
+bsdi4*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  file_magic_cmd=/usr/bin/file
+  file_magic_test_file=/shlib/libc.so
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  export_dynamic_flag_spec=-rdynamic
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw*)
+  version_type=windows
+  need_version=no
+  need_lib_prefix=no
+  if test "$with_gcc" = yes; then
+    library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a'
+  else
+    library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib'
+  fi
+  dynamic_linker='Win32 ld.exe'
+  deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  file_magic_cmd='${OBJDUMP} -f'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  lt_cv_dlopen="LoadLibrary"
+  lt_cv_dlopen_libs=
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+  
+freebsd*)
+  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+  version_type=freebsd-$objformat
+  case "$version_type" in
+    freebsd-elf*)
+      deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+      file_magic_cmd=/usr/bin/file
+      file_magic_test_file=`echo /usr/lib/libc.so*`
+      library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      deplibs_check_method=unknown
+      library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case "$host_os" in
+  freebsd2* | freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  *) # from 3.2 on
+    shlibpath_overrides_runpath=no
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  deplibs_check_method=pass_all
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  dynamic_linker="$host_os dld.sl"
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  shlibpath_var=SHLIB_PATH
+  shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+  library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl'
+  soname_spec='${libname}${release}.sl$major'
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  case "$host_os" in
+  hpux10.20*)
+    # TODO:  Does this work for hpux-11 too?
+    deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+    file_magic_cmd=/usr/bin/file
+    file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+irix5* | irix6*)
+  version_type=irix
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}.so.$major'
+  library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so $libname.so'
+  case "$host_os" in
+  irix5*)
+    libsuff= shlibsuff=
+    # this will be overridden with pass_all, but let us keep it just in case
+    deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+    ;;
+  *)
+    case "$LD" in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  file_magic_cmd=/usr/bin/file
+  file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+  deplibs_check_method='pass_all'
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  deplibs_check_method=pass_all
+
+  if test -f /lib/ld.so.1; then
+    dynamic_linker='GNU ld.so'
+  else
+    # Only the GNU ld.so supports shared libraries on MkLinux.
+    case "$host_cpu" in
+    powerpc*) dynamic_linker=no ;;
+    *) dynamic_linker='Linux ld.so' ;;
+    esac
+  fi
+  ;;
+
+netbsd*)
+  version_type=sunos
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
+    soname_spec='${libname}${release}.so$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+openbsd*)
+  version_type=sunos
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+    need_version=no
+  fi
+  library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+os2*)
+  libname_spec='$name'
+  need_lib_prefix=no
+  library_names_spec='$libname.dll $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_version=no
+  soname_spec='${libname}${release}.so'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  # this will be overridden with pass_all, but let us keep it just in case
+  deplibs_check_method='file_magic COFF format alpha shared library'
+  file_magic_cmd=/usr/bin/file
+  file_magic_test_file=/shlib/libc.so
+  deplibs_check_method='pass_all'
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rhapsody*)
+  version_type=sunos
+  library_names_spec='${libname}.so'
+  soname_spec='${libname}.so'
+  shlibpath_var=DYLD_LIBRARY_PATH
+  deplibs_check_method=pass_all
+  ;;
+
+sco3.2v5*)
+  version_type=osf
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib"
+  file_magic_cmd=/usr/bin/file
+  file_magic_test_file=/lib/libc.so
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case "$host_vendor" in
+    sequent)
+      file_magic_cmd='/bin/file'
+      deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+      ;;
+    ncr)
+      deplibs_check_method='pass_all'
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+      file_magic_cmd=/usr/bin/file
+      file_magic_test_file=`echo /usr/lib/libc.so*`
+      ;;
+  esac
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
+    soname_spec='$libname.so.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+echo "$ac_t$dynamic_linker" 1>&6
+test "$dynamic_linker" = no && can_build_shared=no
+
+# Report the final consequences.
+echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6
+
+# Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in
+# configure.in, otherwise build static only libraries.
+case "$host_os" in
+cygwin* | mingw* | os2*)
+  if test x$can_build_shared = xyes; then
+    test x$enable_win32_dll = xno && can_build_shared=no
+    echo "checking if package supports dlls... $can_build_shared" 1>&6
+  fi
+;;
+esac
+
+if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then
+  case "$deplibs_check_method" in
+  "file_magic "*)
+    file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+    if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+       egrep "$file_magic_regex" > /dev/null; then
+      :
+    else
+      cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+    fi ;;
+  esac
+fi
+
+echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+
+aix4*)
+  test "$enable_shared" = yes && enable_static=no
+  ;;
+esac
+
+echo "$ac_t$enable_shared" 1>&6
+
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+
+echo "checking whether to build static libraries... $enable_static" 1>&6
+
+if test "$hardcode_action" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+echo $ac_n "checking for objdir... $ac_c" 1>&6
+rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+echo "$ac_t$objdir" 1>&6
+
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then
+  lt_cv_dlopen=no lt_cv_dlopen_libs=
+echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "$progname:2248: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2256 "ltconfig"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo $progname:2269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "$progname: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dlopen""... $ac_c" 1>&6
+echo "$progname:2288: checking for dlopen" >&5
+if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2293 "ltconfig"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char dlopen(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_dlopen) || defined (__stub___dlopen)
+choke me
+#else
+dlopen();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo $progname:2318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_dlopen=yes"
+else
+  echo "$progname: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_dlopen=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="dlopen"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6
+echo "$progname:2335: checking for dld_link in -ldld" >&5
+ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldld  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2343 "ltconfig"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link();
+
+int main() {
+dld_link()
+; return 0; }
+EOF
+if { (eval echo $progname:2356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "$progname: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for shl_load""... $ac_c" 1>&6
+echo "$progname:2375: checking for shl_load" >&5
+if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2380 "ltconfig"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char shl_load(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_shl_load) || defined (__stub___shl_load)
+choke me
+#else
+shl_load();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo $progname:2405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_shl_load=yes"
+else
+  echo "$progname: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_shl_load=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="shl_load"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
+echo "$progname:2423: checking for shl_load in -ldld" >&5
+ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldld  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2431 "ltconfig"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load();
+
+int main() {
+shl_load()
+; return 0; }
+EOF
+if { (eval echo $progname:2445: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "$progname: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+fi
+
+    
+fi
+
+  
+fi
+
+
+fi
+
+fi
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  fi
+
+  case "$lt_cv_dlopen" in
+  dlopen)
+for ac_hdr in dlfcn.h; do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "$progname:2488: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2493 "ltconfig"
+#include <$ac_hdr>
+int fnord = 0;
+EOF
+ac_try="$ac_compile >/dev/null 2>conftest.out"
+{ (eval echo $progname:2498: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "$progname: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+    if test "x$ac_cv_header_dlfcn_h" = xyes; then
+      CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+    fi
+    eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+  echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6
+echo "$progname:2526: checking whether a program can dlopen itself" >&5
+if test "${lt_cv_dlopen_self+set}" = set; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+    lt_cv_dlopen_self=cross
+  else
+    cat > conftest.c <<EOF
+#line 2534 "ltconfig"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LTDL_GLOBAL	RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+#  define LTDL_GLOBAL	DL_GLOBAL
+# else
+#  define LTDL_GLOBAL	0
+# endif
+#endif
+
+/* We may have to define LTDL_LAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LTDL_LAZY_OR_NOW
+# ifdef RTLD_LAZY
+#  define LTDL_LAZY_OR_NOW	RTLD_LAZY
+# else
+#  ifdef DL_LAZY
+#   define LTDL_LAZY_OR_NOW	DL_LAZY
+#  else
+#   ifdef RTLD_NOW
+#    define LTDL_LAZY_OR_NOW	RTLD_NOW
+#   else
+#    ifdef DL_NOW
+#     define LTDL_LAZY_OR_NOW	DL_NOW
+#    else
+#     define LTDL_LAZY_OR_NOW	0
+#    endif
+#   endif
+#  endif
+# endif
+#endif
+
+fnord() { int i=42;}
+main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
+    if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
+	       if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } 
+
+EOF
+if { (eval echo $progname:2580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+  lt_cv_dlopen_self=yes
+else
+  echo "$progname: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  lt_cv_dlopen_self=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$lt_cv_dlopen_self" 1>&6
+
+  if test "$lt_cv_dlopen_self" = yes; then
+    LDFLAGS="$LDFLAGS $link_static_flag"
+  echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6
+echo "$progname:2599: checking whether a statically linked program can dlopen itself" >&5
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+    lt_cv_dlopen_self_static=cross
+  else
+    cat > conftest.c <<EOF
+#line 2607 "ltconfig"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LTDL_GLOBAL	RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+#  define LTDL_GLOBAL	DL_GLOBAL
+# else
+#  define LTDL_GLOBAL	0
+# endif
+#endif
+
+/* We may have to define LTDL_LAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LTDL_LAZY_OR_NOW
+# ifdef RTLD_LAZY
+#  define LTDL_LAZY_OR_NOW	RTLD_LAZY
+# else
+#  ifdef DL_LAZY
+#   define LTDL_LAZY_OR_NOW	DL_LAZY
+#  else
+#   ifdef RTLD_NOW
+#    define LTDL_LAZY_OR_NOW	RTLD_NOW
+#   else
+#    ifdef DL_NOW
+#     define LTDL_LAZY_OR_NOW	DL_NOW
+#    else
+#     define LTDL_LAZY_OR_NOW	0
+#    endif
+#   endif
+#  endif
+# endif
+#endif
+
+fnord() { int i=42;}
+main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
+    if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
+    if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } 
+
+EOF
+if { (eval echo $progname:2653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+  lt_cv_dlopen_self_static=yes
+else
+  echo "$progname: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  lt_cv_dlopen_self_static=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6
+fi
+    ;;
+  esac
+
+  case "$lt_cv_dlopen_self" in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case "$lt_cv_dlopen_self_static" in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+# Copy echo and quote the copy, instead of the original, because it is
+# used later.
+ltecho="$echo"
+if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+   ltecho="$CONFIG_SHELL \$0 --fallback-echo"
+fi
+LTSHELL="$SHELL"
+
+LTCONFIG_VERSION="$VERSION"
+
+# Only quote variables if we're using ltmain.sh.
+case "$ltmain" in
+*.sh)
+  # Now quote all the things that may contain metacharacters.
+  for var in ltecho old_CC old_CFLAGS old_CPPFLAGS \
+    old_LD old_LDFLAGS old_LIBS \
+    old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS \
+    AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \
+    reload_flag reload_cmds wl \
+    pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
+    thread_safe_flag_spec whole_archive_flag_spec libname_spec \
+    library_names_spec soname_spec \
+    RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
+    old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \
+    file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \
+    finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
+    hardcode_libdir_flag_spec hardcode_libdir_separator  \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
+
+    case "$var" in
+    reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case "$ltecho" in
+  *'\$0 --fallback-echo"')
+    ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+  trap "$rm \"$ofile\"; exit 1" 1 2 15
+  echo "creating $ofile"
+  $rm "$ofile"
+  cat <<EOF > "$ofile"
+#! $SHELL
+
+# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh.
+#
+# Copyright (C) 1996-1999 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="sed -e s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+### BEGIN LIBTOOL CONFIG
+EOF
+  cfgfile="$ofile"
+  ;;
+
+*)
+  # Double-quote the variables that need it (for aesthetics).
+  for var in old_CC old_CFLAGS old_CPPFLAGS \
+    old_LD old_LDFLAGS old_LIBS \
+    old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS; do
+    eval "$var=\\\"\$var\\\""
+  done
+
+  # Just create a config file.
+  cfgfile="$ofile.cfg"
+  trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+  echo "creating $cfgfile"
+  $rm "$cfgfile"
+  cat <<EOF > "$cfgfile"
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+EOF
+  ;;
+esac
+
+cat <<EOF >> "$cfgfile"
+# Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\
+# LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\
+# NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\
+# DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP AS=$old_AS \\
+#   $0$ltconfig_args
+#
+# Compiler and other test output produced by $progname, useful for
+# debugging $progname, is in ./config.log if it exists.
+
+# The version of $progname that generated this script.
+LTCONFIG_VERSION=$LTCONFIG_VERSION
+
+# Shell to use when invoking shell scripts.
+SHELL=$LTSHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$ltecho
+
+# The archiver.
+AR=$AR
+
+# The default C compiler.
+CC=$CC
+
+# The linker used to build libraries.
+LD=$LD
+
+# Whether we need hard or soft links.
+LN_S=$LN_S
+
+# A BSD-compatible nm program.
+NM=$NM
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$reload_flag
+reload_cmds=$reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$wl
+
+# Object file suffix (normally "o").
+objext="$objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$pic_flag
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$compiler_c_o
+
+# Can we write directly to a .lo ?
+compiler_o_lo=$compiler_o_lo
+
+# Must we lock files when doing compilation ?
+need_locks=$need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$link_static_flag
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$RANLIB
+old_archive_cmds=$old_archive_cmds
+old_postinstall_cmds=$old_postinstall_cmds
+old_postuninstall_cmds=$old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$old_archive_from_new_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$archive_cmds
+archive_expsym_cmds=$archive_expsym_cmds
+postinstall_cmds=$postinstall_cmds
+postuninstall_cmds=$postuninstall_cmds
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$global_symbol_to_cdecl
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$include_expsyms
+
+EOF
+
+case "$ltmain" in
+*.sh)
+  echo '### END LIBTOOL CONFIG' >> "$ofile"
+  echo >> "$ofile"
+  case "$host_os" in
+  aix3*)
+    cat <<\EOF >> "$ofile"
+
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+EOF
+    ;;
+  esac
+
+  # Append the ltmain.sh script.
+  sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1)
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+
+  chmod +x "$ofile"
+  ;;
+
+*)
+  # Compile the libtool program.
+  echo "FIXME: would compile $ltmain"
+  ;;
+esac
+
+test -n "$cache_file" || exit 0
+
+# AC_CACHE_SAVE
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs.  It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already.  You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+  case `(ac_space=' '; set | grep ac_space) 2>&1` in
+  *ac_space=\ *)
+    # `set' does not quote correctly, so add quotes (double-quote substitution
+    # turns \\\\ into \\, and sed turns \\ into \).
+    sed -n \
+      -e "s/'/'\\\\''/g" \
+      -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+    ;;
+  *)
+    # `set' quotes correctly as required by POSIX, so do not add quotes.
+    sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+    ;;
+  esac >> confcache
+if cmp -s $cache_file confcache; then
+  :
+else
+  if test -w $cache_file; then
+    echo "updating cache $cache_file"
+    cat confcache > $cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
+fi
+rm -f confcache
+
+exit 0
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
--- metamail-2.7.orig/config/mkinstalldirs
+++ metamail-2.7/config/mkinstalldirs
@@ -0,0 +1,40 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain
+
+# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
+
+errstatus=0
+
+for file
+do
+   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+   shift
+
+   pathcomp=
+   for d
+   do
+     pathcomp="$pathcomp$d"
+     case "$pathcomp" in
+       -* ) pathcomp=./$pathcomp ;;
+     esac
+
+     if test ! -d "$pathcomp"; then
+        echo "mkdir $pathcomp"
+
+        mkdir "$pathcomp" || lasterr=$?
+
+        if test ! -d "$pathcomp"; then
+  	  errstatus=$lasterr
+        fi
+     fi
+
+     pathcomp="$pathcomp/"
+   done
+done
+
+exit $errstatus
+
+# mkinstalldirs ends here
--- metamail-2.7.orig/Makefile.am
+++ metamail-2.7/Makefile.am
@@ -0,0 +1,14 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+
+auxdir                  = @ac_aux_dir@
+AUX_DIST                = $(auxdir)/install-sh $(auxdir)/missing \
+                        $(auxdir)/mkinstalldirs
+AUX_DIST_EXTRA          = $(auxdir)/readline.m4 $(auxdir)/sys_errlist.m4 \
+                        $(auxdir)/sys_siglist.m4
+EXTRA_DIST              = bootstrap
+
+MAINTAINERCLEANFILES    = Makefile.in aclocal.m4 configure \
+			metamail/config-h.in metamail/stamp-h.in
+
+SUBDIRS                 = replace metamail src bin 
+ACLOCAL                 = aclocal -I $(auxdir)
--- metamail-2.7.orig/Makefile.in
+++ metamail-2.7/Makefile.in
@@ -0,0 +1,349 @@
+# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = .
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AS = @AS@
+CATCOMMAND = @CATCOMMAND@
+CC = @CC@
+DLLTOOL = @DLLTOOL@
+ECHO = @ECHO@
+EXEEXT = @EXEEXT@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LN_S = @LN_S@
+LPRCOMMAND = @LPRCOMMAND@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_aux_dir = @ac_aux_dir@
+
+auxdir = @ac_aux_dir@
+AUX_DIST = $(auxdir)/install-sh $(auxdir)/missing                         $(auxdir)/mkinstalldirs
+
+AUX_DIST_EXTRA = $(auxdir)/readline.m4 $(auxdir)/sys_errlist.m4                         $(auxdir)/sys_siglist.m4
+
+EXTRA_DIST = bootstrap
+
+MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure 			metamail/config-h.in metamail/stamp-h.in
+
+
+SUBDIRS = replace metamail src bin 
+ACLOCAL = aclocal -I $(auxdir)
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = ./metamail/config.h
+CONFIG_CLEAN_FILES = 
+DIST_COMMON =  README COPYING INSTALL Makefile.am Makefile.in aclocal.m4 \
+configure configure.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP_ENV = --best
+all: all-redirect
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
+	cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile
+
+Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
+	cd $(top_builddir) \
+	  && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in 
+	cd $(srcdir) && $(ACLOCAL)
+
+config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	$(SHELL) ./config.status --recheck
+$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
+	cd $(srcdir) && $(AUTOCONF)
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+
+@SET_MAKE@
+
+all-recursive install-data-recursive install-exec-recursive \
+installdirs-recursive install-recursive uninstall-recursive  \
+check-recursive installcheck-recursive info-recursive dvi-recursive:
+	@set fnord $(MAKEFLAGS); amf=$$2; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+	@set fnord $(MAKEFLAGS); amf=$$2; \
+	dot_seen=no; \
+	rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
+	  rev="$$subdir $$rev"; \
+	  test "$$subdir" != "." || dot_seen=yes; \
+	done; \
+	test "$$dot_seen" = "no" && rev=". $$rev"; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS)'; \
+	unique=`for i in $$list; do echo $$i; done | \
+	  awk '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	here=`pwd` && cd $(srcdir) \
+	  && mkid -f$$here/ID $$unique $(LISP)
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+   if test "$$subdir" = .; then :; else \
+	    test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+   fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)'; \
+	unique=`for i in $$list; do echo $$i; done | \
+	  awk '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+	  || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags  $$unique $(LISP))
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+	-rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+
+# This target untars the dist file and tries a VPATH configuration.  Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+	-rm -rf $(distdir)
+	GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
+	mkdir $(distdir)/=build
+	mkdir $(distdir)/=inst
+	dc_install_base=`cd $(distdir)/=inst && pwd`; \
+	cd $(distdir)/=build \
+	  && ../configure --srcdir=.. --prefix=$$dc_install_base \
+	  && $(MAKE) $(AM_MAKEFLAGS) \
+	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
+	  && $(MAKE) $(AM_MAKEFLAGS) check \
+	  && $(MAKE) $(AM_MAKEFLAGS) install \
+	  && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+	  && $(MAKE) $(AM_MAKEFLAGS) dist
+	-rm -rf $(distdir)
+	@banner="$(distdir).tar.gz is ready for distribution"; \
+	dashes=`echo "$$banner" | sed s/./=/g`; \
+	echo "$$dashes"; \
+	echo "$$banner"; \
+	echo "$$dashes"
+dist: distdir
+	-chmod -R a+r $(distdir)
+	GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
+	-rm -rf $(distdir)
+dist-all: distdir
+	-chmod -R a+r $(distdir)
+	GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
+	-rm -rf $(distdir)
+distdir: $(DISTFILES)
+	-rm -rf $(distdir)
+	mkdir $(distdir)
+	-chmod 777 $(distdir)
+	here=`cd $(top_builddir) && pwd`; \
+	top_distdir=`cd $(distdir) && pwd`; \
+	distdir=`cd $(distdir) && pwd`; \
+	cd $(top_srcdir) \
+	  && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign Makefile
+	@for file in $(DISTFILES); do \
+	  d=$(srcdir); \
+	  if test -d $$d/$$file; then \
+	    cp -pr $$d/$$file $(distdir)/$$file; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+	    || cp -p $$d/$$file $(distdir)/$$file || :; \
+	  fi; \
+	done
+	for subdir in $(SUBDIRS); do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d $(distdir)/$$subdir \
+	    || mkdir $(distdir)/$$subdir \
+	    || exit 1; \
+	    chmod 777 $(distdir)/$$subdir; \
+	    (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+info-am:
+info: info-recursive
+dvi-am:
+dvi: dvi-recursive
+check-am: all-am
+check: check-recursive
+installcheck-am:
+installcheck: installcheck-recursive
+install-exec-am:
+install-exec: install-exec-recursive
+
+install-data-am:
+install-data: install-data-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-recursive
+uninstall-am:
+uninstall: uninstall-recursive
+all-am: Makefile
+all-redirect: all-recursive
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs: installdirs-recursive
+installdirs-am:
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f Makefile $(CONFIG_CLEAN_FILES)
+	-rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+	-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+mostlyclean-am:  mostlyclean-tags mostlyclean-generic
+
+mostlyclean: mostlyclean-recursive
+
+clean-am:  clean-tags clean-generic mostlyclean-am
+
+clean: clean-recursive
+
+distclean-am:  distclean-tags distclean-generic clean-am
+	-rm -f libtool
+
+distclean: distclean-recursive
+	-rm -f config.status
+
+maintainer-clean-am:  maintainer-clean-tags maintainer-clean-generic \
+		distclean-am
+	@echo "This command is intended for maintainers to use;"
+	@echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f config.status
+
+.PHONY: install-data-recursive uninstall-data-recursive \
+install-exec-recursive uninstall-exec-recursive installdirs-recursive \
+uninstalldirs-recursive all-recursive check-recursive \
+installcheck-recursive info-recursive dvi-recursive \
+mostlyclean-recursive distclean-recursive clean-recursive \
+maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
+dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
+install-exec install-data-am install-data install-am install \
+uninstall-am uninstall all-redirect all-am all installdirs-am \
+installdirs mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
--- metamail-2.7.orig/stamp-h.in
+++ metamail-2.7/stamp-h.in
@@ -0,0 +1 @@
+timestamp
--- metamail-2.7.orig/INSTALL
+++ metamail-2.7/INSTALL
@@ -0,0 +1,182 @@
+Basic Installation
+==================
+
+   These are generic installation instructions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+   The file `configure.in' is used to create `configure' by a program
+called `autoconf'.  You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.  If you're
+     using `csh' on an old version of System V, you might need to type
+     `sh ./configure' instead to prevent `csh' from trying to execute
+     `configure' itself.
+
+     Running `configure' takes awhile.  While running, it prints some
+     messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  You can give `configure'
+initial values for variables by setting them in the environment.  Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+     CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+     env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory.  After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+   By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc.  You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=PATH' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on.  Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+     CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+   If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+     Use and save the results of the tests in FILE instead of
+     `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
+     debugging `configure'.
+
+`--help'
+     Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`--version'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
--- metamail-2.7.orig/COPYING
+++ metamail-2.7/COPYING
@@ -0,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
--- metamail-2.7.orig/bootstrap
+++ metamail-2.7/bootstrap
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+set -x
+
+aclocal -I config
+libtoolize --force --copy
+autoheader
+automake --foreign --add-missing --copy
+autoconf
