+# Determine installdir from destprog, removing a leading destdir if present.
+if test -n "$destprog_directory"; then
+ installdir="$destprog_directory"
+else
+ installdir=`echo "$destprog" | sed -e 's,/[^/]*$,,'`
+fi
+if test -n "$destdir"; then
+ sed_quote='s,\([|.\*^$[]\),\\\1,g'
+ sed_remove_destdir='s|^'`echo "$destdir" | sed -e "$sed_quote"`'||'
+ installdir=`echo "$installdir" | sed -e "$sed_remove_destdir"`
+fi
+
+# Compile and install wrapper.
+func_create_wrapper ()
+{
+ # Remove trailing $exeext, if present.
+ if test -n "$exeext"; then
+ destprog=`echo "$destprog" | sed -e "$sed_remove_exeext"`
+ fi
+
+ # Compile wrapper.
+ func_verbose $compile_command \
+ -I"$builddir" -I"$srcdir" -I"$config_h_dir" \
+ -DHAVE_CONFIG_H -DIN_RELOCWRAPPER -DNO_XMALLOC \
+ -D"INSTALLPREFIX=\"$prefix\"" -D"INSTALLDIR=\"$installdir\"" \
+ -D"LIBPATHVAR=\"$library_path_var\"" -D"LIBDIRS=$libdirs" \
+ -D"EXEEXT=\"$exeext\"" \
+ "$srcdir"/relocwrapper.c \
+ "$srcdir"/progname.c \
+ "$srcdir"/progreloc.c \
+ "$srcdir"/areadlink.c \
+ "$srcdir"/careadlinkat.c \
+ "$srcdir"/allocator.c \
+ "$srcdir"/readlink.c \
+ "$srcdir"/canonicalize-lgpl.c \
+ "$srcdir"/malloca.c \
+ "$srcdir"/relocatable.c \
+ "$srcdir"/setenv.c \
+ "$srcdir"/strerror.c \
+ "$srcdir"/c-ctype.c \
+ -o "$destprog.wrapper$exeext"
+ rc=$?
+ # Clean up object files left over in the current directory by the native C
+ # compilers on Solaris, HP-UX, OSF/1, IRIX.
+ rm -f relocwrapper.o \
+ progname.o \
+ progreloc.o \
+ areadlink.o \
+ careadlinkat.o \
+ allocator.o \
+ readlink.o \
+ canonicalize-lgpl.o \
+ malloca.o \
+ relocatable.o \
+ setenv.o \
+ strerror.o \
+ c-ctype.o
+ test $rc = 0 || exit $?
+ # Clean up debugging information left over by the native C compiler on MacOS X.
+ rm -rf "$destprog.wrapper$exeext.dSYM"
+ test $rc = 0 || exit $?
+
+ # Strip wrapper.
+ test "$strip_prog" = ':' || func_verbose "$strip_prog" "$destprog.wrapper$exeext" || exit $?