-# 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 Mac OS X.
-rm -rf "$destprog.wrapper$exeext.dSYM"
-test $rc = 0 || exit $?
-
-# Strip wrapper.
-test "$strip_prog" = ':' || func_verbose "$strip_prog" "$destprog.wrapper$exeext" || exit $?
-
-# Rename $destprog.wrapper -> $destprog -> $destprog.bin.
-ln -f "$destprog$exeext" "$destprog.bin$exeext" \
- || { rm -f "$destprog.bin$exeext" \
- && cp -p "$destprog$exeext" "$destprog.bin$exeext"; } \
- || exit 1
-mv "$destprog.wrapper$exeext" "$destprog$exeext" || exit 1
+# 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"/strerror-override.c \
+ "$srcdir"/stat.c \
+ "$srcdir"/lstat.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 $?
+
+ # Rename $destprog.wrapper -> $destprog -> $destprog.bin.
+ ln -f "$destprog$exeext" "$destprog.bin$exeext" \
+ || { rm -f "$destprog.bin$exeext" \
+ && cp -p "$destprog$exeext" "$destprog.bin$exeext"; } \
+ || exit 1
+ mv "$destprog.wrapper$exeext" "$destprog$exeext" || exit 1
+}
+func_iterate func_create_wrapper