* README: Append ".git" to git and cg examples.
[gnulib.git] / build-aux / install-reloc
index 4c2c332..1994438 100755 (executable)
@@ -1,12 +1,12 @@
 #!/bin/sh
 # install-reloc - install a program including a relocating wrapper
-# Copyright (C) 2003, 2005-2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2005-2007 Free Software Foundation, Inc.
 # Written by Bruno Haible <bruno@clisp.org>, 2003.
 #
-# This program is free software; you can redistribute it and/or modify
+# 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.
+# the Free Software Foundation; either version 3 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
 # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Usage:
-#   install-reloc library_path_var library_path_value prefix compile_command srcdir config_h_dir exeext install_command... destprog
+#   install-reloc library_path_var library_path_value prefix \
+#                 compile_command srcdir config_h_dir exeext \
+#                 install_command... destprog
 # where
 #   - library_path_var is the platform dependent runtime library path variable
 #   - library_path_value is a colon separated list of directories that contain
@@ -70,7 +71,9 @@ else
     shift
     shift
   else
-    echo "Usage: $0 library_path_var library_path_value prefix compile_command srcdir builddir config_h_dir exeext install_command... destprog" 1>&2
+    echo "Usage: $0 library_path_var library_path_value prefix" \
+         "compile_command srcdir builddir config_h_dir exeext" \
+         "install_command... destprog" 1>&2
     exit 1
   fi
 fi
@@ -119,11 +122,45 @@ test -n "$libdirs" || exit 0
 
 # Compile wrapper.
 installdir=`echo "$destprog" | sed -e 's,/[^/]*$,,'`
-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"/xreadlink.c "$srcdir"/readlink.c "$srcdir"/canonicalize-lgpl.c "$srcdir"/allocsa.c "$srcdir"/relocatable.c "$srcdir"/setenv.c "$srcdir"/strerror.c "$srcdir"/c-ctype.c -o "$destprog.wrapper$exeext" || exit $?
+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"/xreadlink.c \
+             "$srcdir"/areadlink.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 \
+      xreadlink.o \
+      areadlink.o \
+      canonicalize-lgpl.o \
+      malloca.o \
+      relocatable.o \
+      setenv.o \
+      strerror.o \
+      c-ctype.o
+test $rc = 0 || 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"; } \
+  || { rm -f "$destprog.bin$exeext" \
+       && cp -p "$destprog$exeext" "$destprog.bin$exeext"; } \
   || exit 1
 mv "$destprog.wrapper$exeext" "$destprog$exeext" || exit 1