* configure.in: Add i386 to cpp_undefs (Bug#8497).
[bpt/emacs.git] / admin / quick-install-emacs
index 19148a3..1736b9c 100755 (executable)
@@ -1,9 +1,32 @@
 #!/bin/sh
-# quick-install-emacs -- do a halfway-decent job of installing emacs quickly
-# Written by Miles Bader <miles@gnu.org>
+### quick-install-emacs --- do a halfway-decent job of installing emacs quickly
+
+## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+##   Free Software Foundation, Inc.
+
+## Author: Miles Bader <miles@gnu.org>
+
+## This file is part of GNU Emacs.
+
+## GNU Emacs 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 3 of the License, or
+## (at your option) any later version.
+
+## GNU Emacs 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 GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+
+### Commentary:
+
+## This script is mainly intended for emacs maintainer or pretesters who
+## install emacs very often.  See the --help output for more details.
 
-# This script is mainly intended for emacs maintainer or pretesters who
-# install emacs very often.  See the --help output for more details.
 
 PUBLIC_LIBSRC_BINARIES='b2m emacsclient etags ctags ebrowse'
 PUBLIC_LIBSRC_SCRIPTS='grep-changelog rcs-checkin'
@@ -19,15 +42,16 @@ VERBOSE=''
 
 me="`basename $0`"
 
-# Install commands (these commands are also expected to understand the
-# GNU -v (--verbose) option)
+# Install commands (if the user specifies the `--verbose' option, it is
+# passed to these commands, so that feature only works if these commands
+# implement it too)
 LINK='cp -lf'
 COPY='cp -f'
 REMOVE='rm -r'
+MKDIR='mkdir -p'
 
 # Used to execute commands once once we create them
 EXEC='sh'
-MKDIR='mkdir --verbose -p'
 
 NAWK=/usr/bin/nawk
 
@@ -133,12 +157,14 @@ elif test ! -r "$BUILD/config.status"; then
 fi
 
 CONFIG_STATUS="$BUILD/config.status"
-function get_config_var () {
-  if ! sed -n "s/^s\(.\)@$1@\1\(.*\)\1.*$/\2/p" $CONFIG_STATUS | sed q | grep ''
-  then
+get_config_var ()
+{
+  { sed -n "s/^S[[]\"$1\"[]]=\"\([^\"]*\)\"/\1/p" $CONFIG_STATUS | sed q | grep ''; } ||
+  { sed -n "s/^s\(.\)@$1@\1\(|#_!!_#|\)*\(.*\)\1.*$/\3/p" $CONFIG_STATUS | sed q | grep ''; } ||
+  {
     echo 1>&2 "$me: $1: Configuration variable not found in $CONFIG_STATUS"
     exit 4
-  fi
+  }
 }
 
 test x"$SRC" = x && { SRC="`get_config_var srcdir`" || exit 4 ; }
@@ -151,11 +177,24 @@ VERSION=`grep 'defconst[   ]*emacs-version' $SRC/lisp/version.el \
 DST_SHARE="$prefix/share/emacs/$VERSION"
 DST_BIN="$prefix/bin"
 DST_LIBEXEC="$prefix/libexec/emacs/$VERSION/$ARCH"
-DST_INFO="$prefix/info"
 
-function maybe_mkdir () {
+# There are various common places for the info dir to be, so try to
+# use whatever's already there, defaulting to (and preferring)
+# .../share/info.
+#
+DST_INFO=''
+for D in "$prefix/share/info" "$prefix/info"; do
+  if test -d "$D"; then
+    DST_INFO="$D"
+    break
+  fi
+done
+DST_INFO=${DST_INFO:-"$prefix/share/info"}
+
+maybe_mkdir ()
+{
   if ! test -d "$1"; then
-    $MKDIR "$1" 2>&1 | sed "s/^mkdir:/$me:/" 1>&2
+    $MKDIR $VERBOSE "$1" 2>&1 | sed "s/^mkdir:/$me:/" 1>&2
   fi
 }
 
@@ -181,7 +220,8 @@ fi
 
 test x"$PRUNE" = xonly && exit 0
 
-function maybe_emit_copy () {
+maybe_emit_copy ()
+{
   if test "$FORCE" = yes || ! cmp -s $1 $2; then
     echo $LINK_CMD $1 $2
   fi
@@ -236,7 +276,7 @@ for SUBDIR in lisp leim etc lib-src info; do
        if [ -d $DST/$DIR ]; then
          echo Directory $DST/$DIR exists
        else
-         echo Directory $DST/$DIR non-existant
+         echo Directory $DST/$DIR non-existent
          if [ "`echo $DIR | egrep -v "$AVOID_PAT"`" ]; then
            maybe_mkdir $DST/$DIR
          fi